Forms Substitution Within A Loop

lhooker

Registered User.
Local time
Today, 14:30
Joined
Dec 30, 2005
Messages
419
How can I substitute "A1" in a "Forms" statement within a loop (as shown below) to move to the next textbox in a form.

Dim strAs As String
Dim Counter As Integer
Counter = 0

Do Until Counter = 30
Counter = Counter + 1
varX = DLookup("Question" & Counter, "Answers_Horizontal")
strAs = "[" & "A" & Counter & "]
"[Forms]![Form_Questions]!" & strAs & " = varX"
Loop


This is the original syntax ===> [Forms]![Form_Questions]![A1] = varX
I do not want create thirty (30) "Forms" statements.
 
Why not respond back to the original thread you made for this:


People had given advice.
 
Again. Dot notation not bang.
 
Why not respond back to the original thread you made for this:


People had given advice.
I did already . . . I used the EXCEL 'Transpose' feature.
 
maybe try:
Code:
Do Until Counter = 30
    Counter = Counter + 1
    varX = DLookup("Question" & Counter, "Answers_Horizontal")
    strAs = "A" & Counter
    Forms("Questions").Controls(strAs) = varX
Loop
 
Last edited:

Users who are viewing this thread

Back
Top Bottom