How to change the label caption of a variable label name?

Jaco K

Registered User.
Local time
Today, 11:44
Joined
Aug 4, 2006
Messages
12
I have n horizontal labels named Label_1 to Label_n. I'd like to assign values to the label captions by using a loop.
Something like:

For i = 1 To n
Set Label_i.Caption = i
End

However, this doesn't work. Message "Object required".

Any suggestions?
 
Change

Set Label_i.Caption = i

to

Me.Controls("Label_" & i).Caption = i

By the way, in the future pay attention to what forum you post in. This one is for FAQ's, and it's not appropriate to post regular questions here.
 

Users who are viewing this thread

Back
Top Bottom