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

Seting a textbox name by passing a variable

Status
Not open for further replies.

JohnBlaze

Technical User
Apr 5, 2002
16
US
I have a procedure that takes in a query name as an argument, then returns values based on that query. If I have 30 such queries, with the name Query1 thorugh Query30. I want to populate txtBox1 with Query1's results, etc.
However when I try and name pass the n as the "1" in query1 and construct Me!txtBox1, it reads this as text. How would i get this to work?
 
Not sure I understand clearly, but here's what I can say. Sounds like you already know how to get the 1 in query1. When you construct the textbox, use the Name property. Me.<textbox>.Name = &quot;txtbox&quot; & n
Also,
Me.Controls(&quot;<name>&quot; OR index).Name = &quot;txtbox&quot; & n
 
If you're just trying to refer to textbox n,
Me.Controls(&quot;txtbox&quot; & n)
 
Thanks, I am not sure I understand though. I wanted to populate the textbox based on what query was ran. So that the results from Query2, would populate txtBox2. And when Query3 is passed, the results would populate txtBox3. I dont see how this would work with the code you have sent. Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top