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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert a string variable in object variable

Status
Not open for further replies.

denis60

Technical User
Apr 19, 2001
89
CA
Hi everyone
I have a textbox in my form that i want to control in a variable.
If i use this sentence with the real textbox name, it work:
Dim MyItem as object
MyItem = txbTicket
xx = MyItem.tag

How to do the same thing with the textbox name in a variable like:
Dim MyItem as object
MyVar = "txbTicket"
MyItem = MyVar
xx = MyItem.tag

 
Try this.

[tt]Dim MyItem As Object
MyVar = "txbTicket"
Set MyItem = Controls(MyVar)
xx = MyItem.Tag[/tt]
 
Thanks Hypetia
That exactly what i was looking for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top