user1822457
user1822457

Reputation: 1

Concat textbox name with string

greetings for all access experts in this forum

I got problems when trying to concat between my text box name with string.

In my form there are 10 textboxs named : Student1, Student2, Student3...Student10

I tried to get value from each textbox

This is my code :

Dim a as string
a = 1
do until a = 2
MsgBox (Me.Controls("Student"&a).Value)
loop

It's not working. No error also.

Any help would be appreciated.

Many thanks.

Upvotes: 0

Views: 1189

Answers (1)

Gord Thompson
Gord Thompson

Reputation: 123419

Try something more like this:

Dim i As Integer
For i = 1 To 3
    MsgBox Nz(Me.Controls("Student" & i).Value, "")
Next

Upvotes: 1

Related Questions