I have some controls on a VB form, and I want to set properties based upon a variable. More specifically...I have a series of checkboxes in Access VBA, and I want to loop through an array and for each value reset the caption of the checkbox labels. So my labels are named 'lbl1', 'lbl2', etc. (since Access seemingly won't let me create a control array), and as my loop executes I'd like to say:
Dim oCtrl as Control
Set oCtrl = "lbl" & a
This of course doesn't work since the datatypes don't match. The only way I've succeeded in doing something along these lines is by looping through all of the controls on my form and using the Control.Name property to compare against my string variable...but it seems that there must be a more elegant way.
Dim oCtrl as Control
Set oCtrl = "lbl" & a
This of course doesn't work since the datatypes don't match. The only way I've succeeded in doing something along these lines is by looping through all of the controls on my form and using the Control.Name property to compare against my string variable...but it seems that there must be a more elegant way.