Reset Label Caption to the Default

M

Mike Thomas

In Access 2000, we have a form with 10 labels for which the caption needs to
display a custom string if a condition is true, and display the default, eg
the caption put in at design time, when the condition is false.

The sub to change the caption is called by the form's current event as well
as by a couple of other events and is as follows:

If condition then
me.labelA.caption = "Custom Caption"
...
Else
me.labelA.caption = "Default Caption"
...
Endif

When the condition is false, is there a way to have the label's caption
revert to the default without having to code the default back in again as
above?

Many thanks
Mike Thomas
 
G

Graham Mandeno

Hi Mike

The saved caption is not stored anywhere accessible.

However, you could use the label's tag property:
labelA.Caption = labelA.Tag

You can either set the Tag in design view, or set it in code when the form
opens.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top