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

Need help referencing a form dynamically

Status
Not open for further replies.

MrCancelled

Programmer
Dec 14, 2001
1
US
Hello,

I'm having a problem referencing a series of form controls using a For Next loop using Access/VB.

I have a series of text entry fields all named relatively, the same. The only difference between their names is a number indicating their sequence.

For example:
TextEntry1Name
TextEntry2Name
TextEntry3Name

and so on...

I'm trying to do something like:

for z = 1 to 10
MyForm!TextEntry & z & Name.value = Value(z)
next z

And setting all the fields....

But I'm having a problem determining the correct syntax in order to achieve the above.

Can anyone help me out?
 
Put it in parenthesis:
MyForm("TextEntry" & z & "name") = value(z)
--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top