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

Use string as the name of a text box on form

Status
Not open for further replies.

jgarry

Programmer
Nov 23, 2004
67
US
Hi, thanks in advance.

on the form I have created I am useing a mdb table to store the field names that I want to populate.

To populate the fields I have to connect to a PLC. this is no problem. what Is the problem is I have about 50 fields that I want to populate from the PLC

I want to take the routine and streamline the operation.

so I put the names in the table and now want to loop through each filed populating the form.

my problem is how do I use the table name as the text box name on the form?


I open the recordset in another sub

Do Until rs_tabs.EOF

str_text = "txt_" & rs_tabs.Fields("t_vb_Tag")
str_global = "g_" & rs_tabs.Fields("t_vb_Tag")

str_text.LinkTimeOut = LinkTimeOut
str_text.LinkTopic = CurrentLinkTopic
str_text.LinkItem = str_global
rs_tabs.MoveNext
loop

when I run the program the str_text is what I want the value of it is txt_BenderStatus now I want to relate this to the form. where I have a field called txt_benderStatus.
when I run this I get the error Invalid qualifier.

Any suggestions?

Thanks again

Jim







 
I seem to remember rs_tabs.Fields(("t_vb_Tag")).Name gives the name of that column.
txt_BenderStatus.caption =rs_tabs.Fields("t_vb_Tag").Name
then find the data and move next etc
 
Thanks Tedsmith, I will give it a try and let you know.

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top