Text Box Variable

hascons

Registered User.
Local time
Today, 15:11
Joined
Apr 20, 2009
Messages
58
I was wondering if it is possible to reference a textbox name property with a variable. I have a form that has 16 textboxes (txtHome-1 - txtHome-16) I was hoping to be able to loop through them and fill each textbox with different Data without having to specifically set all txtBoxes individually.

Something Like:

Private Sub cmdPractice_Click()

Dim i As Integer
Dim Nme As String

For i = 1 To 16
Nme = "txtHome-" & i
Me.Controls(Nme) = HELLO
Next i

End Sub


Is this Possible to do with access forms?

Hascons
 
That should work, but you'd want Hello in quotes:

Me.Controls(Nme) = "HELLO"
 
Works Perfect

Thanks Paul
 

Users who are viewing this thread

Back
Top Bottom