Reputation: 151
I have tbxInvites0 ... tbxInvites6. I would like to create a for loop which will increment the tbxInvites# and assign tbxInvites# = Invites. This is the idea but obviously won't work:
For DBNum = 0 to 6
frm.tbxInvites & DBNum = Invites
Next DBNum
Upvotes: 2
Views: 770
Reputation: 97101
frm.tbxInvites & DBNum
will give you a string, not a text box object. However, you can use a string to reference a control as member of your form's Controls
collection.
For DBNum = 0 to 6
'frm.tbxInvites & DBNum = Invites
Me.Controls("tbxInvites" & DBNum).Value = Invites
Next DBNum
Upvotes: 1