Hi guys. I am now retired and a bit rusty..
I am trying to set up a for:next loop to update several checkbox labels.
The following code should (I thought) change a set of 3 labels (named chklabel1 to chklabel3)to read one, two and three.
[tab]Dim var1 As String
[tab]Dim var2 As String
[tab]Dim var3 As String
[tab]Dim tempcontrol As String
[tab]var1 = "one"
[tab]var2 = "two"
[tab]var3 = "three"
[tab]For n = 1 To 3
[tab][tab]tempcontrol = "chklabel" & n
[tab][tab]Set tempcontrol = Label
[tab][tab]tempcontrol.Caption = var1
[tab]Next n
This refuses to compile at the line "Set tempcontrol = Label" and states that it wants an object.
Now I'm struggling. Anyone able to help on the correct syntax/code please?
(Access 2000, the form name is "frmtest")
Telephoto
I am trying to set up a for:next loop to update several checkbox labels.
The following code should (I thought) change a set of 3 labels (named chklabel1 to chklabel3)to read one, two and three.
[tab]Dim var1 As String
[tab]Dim var2 As String
[tab]Dim var3 As String
[tab]Dim tempcontrol As String
[tab]var1 = "one"
[tab]var2 = "two"
[tab]var3 = "three"
[tab]For n = 1 To 3
[tab][tab]tempcontrol = "chklabel" & n
[tab][tab]Set tempcontrol = Label
[tab][tab]tempcontrol.Caption = var1
[tab]Next n
This refuses to compile at the line "Set tempcontrol = Label" and states that it wants an object.
Now I'm struggling. Anyone able to help on the correct syntax/code please?
(Access 2000, the form name is "frmtest")
Telephoto