refering to Textboxes programmatically

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to assign a variable to a textbox, then change the variable in
order to assign it to another text box? For example, let's say i have 4 text
boxes: Text1_1, Text1_2, Text1_3, and Text1_4 on a form, Form1.

is it possible to do something like:

For i = 1 to 4

set vbox = "Form_Form1.Text1_" & i
Form_From1.Text1_" & i = 100

next i

If so how what am i doing wrong?

Thanks in advance,

Pete M
 
Pete said:
Is it possible to assign a variable to a textbox, then change the
variable in order to assign it to another text box? For example,
let's say i have 4 text boxes: Text1_1, Text1_2, Text1_3, and
Text1_4 on a form, Form1.

is it possible to do something like:

For i = 1 to 4

set vbox = "Form_Form1.Text1_" & i
Form_From1.Text1_" & i = 100

next i

If so how what am i doing wrong?

Use...

set vbox = Form_Form1("Text1_" & i)
Form_From1("Text1_" & i) = 100
 
Pete said:
Is it possible to assign a variable to a textbox, then change the variable in
order to assign it to another text box? For example, let's say i have 4 text
boxes: Text1_1, Text1_2, Text1_3, and Text1_4 on a form, Form1.

is it possible to do something like:

For i = 1 to 4

set vbox = "Form_Form1.Text1_" & i
Form_From1.Text1_" & i = 100

next i


Don't use the Form_ syntax to refer to control values.

Don't use Set when you want to assign a value.

For i = 1 To 4
Forms!From1("Text1_" & i) = 100
Next i
 
Back
Top