Why doesn't this work? (1 Viewer)

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
 

simongallop

Registered User.
Local time
Today, 17:31
Joined
Oct 17, 2000
Messages
611
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.
 
D

dereksmalls

Guest
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

Top Bottom