Biggles1
asked on
Change label captions in Access VBA SEQUENTIALLY
I have a form with labels called lbl1, lbl2, lbl3 ....... lbl60
I want to write code that will refer to each label in turn and change the caption.
This code does NOT work:
Dim X as Integer
For X = 1 to 60
Me.lbl & X & .Caption = "X"
Next X
I DON'T want to write 60 lines of code like this:
Me.lbl1.Caption = "1"
Me.lbl2.Caption = "2"
Me.lbl3.Caption = "3"
.....
Me.lbl60.Caption = "60"
Any Ideas what I am doing wrong?
Thanks,
Biggles1
I want to write code that will refer to each label in turn and change the caption.
This code does NOT work:
Dim X as Integer
For X = 1 to 60
Me.lbl & X & .Caption = "X"
Next X
I DON'T want to write 60 lines of code like this:
Me.lbl1.Caption = "1"
Me.lbl2.Caption = "2"
Me.lbl3.Caption = "3"
.....
Me.lbl60.Caption = "60"
Any Ideas what I am doing wrong?
Thanks,
Biggles1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Biggles