S
Suggy1982
I have got 3 label controls on a form; each label control has it own name
(list below)
- lbl_div_nbr_1
- lbl_div_name_1
- lbl_div_charge_1
These set of 3 labels are then repeats 3 times on the same form, with the
name being the only thing that changes e.g.
- lbl_div_nbr_2
- lbl_div_name_2
- lbl_div_charge_2
- lbl_div_nbr_3
- lbl_div_name_3
- lbl_div_charge_3
I would like to use a For….next statement to look through and set the values
on these labels and make them visible, rather than having to write out 9
separate statements to do this, but my code below isn’t working. It is
returning an error saying it cannot find “Forms!menu!lbl_div_nbr_x.Captionâ€
For x = 1 to 3
Forms!menu!lbl_div_nbr_x.Caption = “testâ€
Forms!menu!lbl_div_nbr_x.Visible = True
Forms!menu!lbl_div_name_x.Caption = “testâ€
Forms!menu!lbl_div_name_x.Visible = True
Forms!menu!lbl_div_charge_x.Caption = “testâ€
Forms!menu!lbl_div_charge_x.Visible = True
Next
(list below)
- lbl_div_nbr_1
- lbl_div_name_1
- lbl_div_charge_1
These set of 3 labels are then repeats 3 times on the same form, with the
name being the only thing that changes e.g.
- lbl_div_nbr_2
- lbl_div_name_2
- lbl_div_charge_2
- lbl_div_nbr_3
- lbl_div_name_3
- lbl_div_charge_3
I would like to use a For….next statement to look through and set the values
on these labels and make them visible, rather than having to write out 9
separate statements to do this, but my code below isn’t working. It is
returning an error saying it cannot find “Forms!menu!lbl_div_nbr_x.Captionâ€
For x = 1 to 3
Forms!menu!lbl_div_nbr_x.Caption = “testâ€
Forms!menu!lbl_div_nbr_x.Visible = True
Forms!menu!lbl_div_name_x.Caption = “testâ€
Forms!menu!lbl_div_name_x.Visible = True
Forms!menu!lbl_div_charge_x.Caption = “testâ€
Forms!menu!lbl_div_charge_x.Visible = True
Next