Why doesn't this work?

  • Thread starter Thread starter dereksmalls
  • Start date Start date
D

dereksmalls

Guest
Private Sub Form_Load()
Dim a As Label
Dim b As String
b = "label0"
Set a = b
a.Caption = "test13"
End Sub
 
Access doesn't like a string being converted to a control. Having a quick test, if you declare b as either label or control and have:

Set b = label0 [Note: no quotes]

it then works.
 
That's fine, but I want to be able to change the caption on a whole list of Labels and so I have a loop that creates the label name and saves it to a string but then I can't set the label variable using that string. Can this be done?
THanks in advance
 

Users who are viewing this thread

Back
Top Bottom