Label's Caption Issue

M

Martin

Well, I’m working on Access 2003. I’m trying to change the text shown on a
label, that change depends on some control’s value. I used the Form_Current
event. My code has the following shape:

Me.lblHeader.Caption=â€XXXXXXXâ€

Surprisingly, it doesn’t work. With other forms it does but not with this
one.

Any of you know what could be wrong? Is there a property straight-line
linked to this that I might have changed and it's preventing my code to run
properly?

Any help is highly appreciated… thank you very much
 
J

Jeanette Cunningham

Hi Martin,
are you sure you have the correct name for the label?
lblHeader

If you put a break in the code at the line
Me.lblHeader.Caption="XXXXXXX"

you can see if the code gets called.

To put a break point, click in the far, far left of the code Private Sub
Form_Current()
That line will become colored - usually red.

Now you can open the form in normal view and run the form.
When the code gets to the current event, the code window will open at the
break point and you can watch what happens, by pressing F8 to make the code
jump to the next line, then keep pressing F8 until the code has finished
running.



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
J

Jack Leach

Sometimes I run into issues with labels that are "married" to a control. Try
deleting the "married" label and replacing it with a fresh one that isn't
tied to the control. I believe this did the trick for me when I come across
the same issue.

hth
--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
S

Stuart McCall

Jack Leach said:
Sometimes I run into issues with labels that are "married" to a control.
Try
deleting the "married" label and replacing it with a fresh one that isn't
tied to the control. I believe this did the trick for me when I come
across
the same issue.

hth
--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)

Jack

FYI you can do this more easily using the clipboard.

Click the 'married' label to select it.
Ctrl-X
Select the form
Ctrl-V

This also works in reverse in order to 'marry' a label to a control.
 

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

Top