Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable in Form Label

Status
Not open for further replies.

GGleason

Technical User
Mar 22, 2001
321
0
0
US
I want to change the caption of a label in a form by using a variable. During module execution, I have a variable called strLabel that is set to the label name. I then have module code like the following:

Application.Forms("frmTools")!(strLabel).Caption = "Hammer"

But this syntax is not correct (it turns red).

What should the syntax be?

TIA,
GGleason
 
all you need to do is create a string variable named strLabel.. assign strLabel whatever value you want... then just include this line with name changes of course:
Me.txtLable.caption = strLabel
 
I think my question was not phrased carefully. The variable is part of the object name, not the object's value.

Application.Forms("frmTools")!(strLabel).Caption = "Hammer"

I hope this makes sense.

Thanks
GGleason
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top