Variable for Label Name

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

Guest

Is there any way to use a 'variable' for the name of a label on a form. Such
as - if you have a form with ten labels on it named 'Label1', 'Label2', . .
.., 'Label10', is there any way to use code such as this to reference them:

for xx = 1 to 10
Label'xx' = data
next xx
 
Using the Controls collection

For i = 1 to 10
Me.Controls("Label" & i).Object.Caption = "something"
Next i
 
Works perfectly. Thank you very much!


Juan Pablo González said:
Using the Controls collection

For i = 1 to 10
Me.Controls("Label" & i).Object.Caption = "something"
Next i
 
Back
Top