G
Guest
lets say I have form objects... L01,L02,L03....L35,L36 (in this instance
checkbox labels)
how can I directly reference them through indirect textual calculation?
like...
Function lblr(LO As Object, pntr As String)
'LO.Caption = DLookup("DistLbl", "DistLabel", "Code=" & pntr)
'DLookup("DistLbl", "DistLabel", "Code = pntr")
LO.Caption = DLookup("DistLbl", "DistLabel", "Code = pntr")
End Function
Private Sub Form_Open(Cancel As Integer)
Dim i As Integer
Dim ctrl As Object
'Dim LblRef As string
Dim LblRef As Variant
L01.Caption = DLookup("DistLbl", "DistLabel", "Code='01'")
For i = 2 To 36
Set ctrl = Nothing
LblRef = "L" & Format(i, "00")
Set ctrl.Type = Label
Set ctrl.Name = LblRef
ctrl.Caption = lblr(ctrl, Format(i, "00"))
Next i
however it bombs before I can specify the object I wish to manipulate
NOTE: some of the statements are commented out as they are other avenues
explored and rejected
checkbox labels)
how can I directly reference them through indirect textual calculation?
like...
Function lblr(LO As Object, pntr As String)
'LO.Caption = DLookup("DistLbl", "DistLabel", "Code=" & pntr)
'DLookup("DistLbl", "DistLabel", "Code = pntr")
LO.Caption = DLookup("DistLbl", "DistLabel", "Code = pntr")
End Function
Private Sub Form_Open(Cancel As Integer)
Dim i As Integer
Dim ctrl As Object
'Dim LblRef As string
Dim LblRef As Variant
L01.Caption = DLookup("DistLbl", "DistLabel", "Code='01'")
For i = 2 To 36
Set ctrl = Nothing
LblRef = "L" & Format(i, "00")
Set ctrl.Type = Label
Set ctrl.Name = LblRef
ctrl.Caption = lblr(ctrl, Format(i, "00"))
Next i
however it bombs before I can specify the object I wish to manipulate
NOTE: some of the statements are commented out as they are other avenues
explored and rejected