G
Guest
I am trying to set the value of a set of controls on a form programmatically.
Using something like the following code:
Do While Not rs.EOF
sCtlName = "txt" + LTrim(Str(i))
Forms![main menu].Controls(sCtlName).Caption = rs![menu_item_description]
i = i + 1
rs.MoveNext
Loop
where the controls are named txt0, txt1, txt2 etc.. If I substitute "txt0"
into the line above it works fine but with the variable it gives me an
"object does not support this property or method" message.
How do I format this line so it will accept the variable for the control
name?
Using something like the following code:
Do While Not rs.EOF
sCtlName = "txt" + LTrim(Str(i))
Forms![main menu].Controls(sCtlName).Caption = rs![menu_item_description]
i = i + 1
rs.MoveNext
Loop
where the controls are named txt0, txt1, txt2 etc.. If I substitute "txt0"
into the line above it works fine but with the variable it gives me an
"object does not support this property or method" message.
How do I format this line so it will accept the variable for the control
name?