Retrieve Value From Multiple Textboxes

lhooker

Registered User.
Local time
Today, 11:05
Joined
Dec 30, 2005
Messages
423
How can I create a loop to retrieve the value of multiple textboxes ? For example "A1" would become "A2" . . . "A55". I would then retrieve and display the value of the textbox. The below syntax will display the value of my form "Form_Questions" and textbox "A1":banghead:.

Forms![Form_Questions]![A1]
 
Is this loop executing in the Form_Questions Form? Where do you plan to place the returned values?
 
In a VBA variable
 
I tried that . . . I just get the text value, but not the value of the testbox.

Aout = "Forms![Form_Questions]!" & "[A" & i & "]"
 
The syntax will be something like:
Forms![Form_Questions].Controls("A" & i)
Is this executing on the same form as the controls?
 
Actually I don't think you can use the (Form_) syntax in the Forms collection. If the name of the form in "Questions" then the syntax would be "Forms!Questions.Controls("A" & i)"
 
This did not work either. Do I have to change the form name (i.e. "Form_Questions") to something else ?
 
The code is part of a form (i.e. "Form_Questions"). The textbox are "A1" through "A80". This form is a survey and I'm trying to loop through the answers from the survey with VBA.
 
You do not need to user the Forms Collection. Just use: Aout = Me.Controls("A" & i)
 
Now I'm getting a return of "False". See code below

i = 0
Do While i < 3
i = i + 1
Aout = Me.Controls("A" & i)
MsgBox Aout = Aout & i
Loop
End
 

Users who are viewing this thread

Back
Top Bottom