G
Guest
NOTE: some statements in following code commented out to show other avenues
explored and rejected on failure
How do I directly reference a form object through indirect textual
calculated methods???
suppose I have form objects... L01,L02,L03...L09,L10 (in this case checkbox
labels)
I want to set the captions via a lookup @ form open
the below blows before I can specify the control I wish to manipulate
Function lblr(LO As Object, pntr As String)
'LO.Caption = DLookup("ListLbl", "ListLabel", "Code=" & pntr)
'DLookup("ListLbl", "ListLabel", "Code = pntr")
LO.Caption = DLookup("ListLbl", "ListLabel", "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("ListLbl", "ListLabel", "Code='01'") '<<<This Works
For i = 2 To 10
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
....
explored and rejected on failure
How do I directly reference a form object through indirect textual
calculated methods???
suppose I have form objects... L01,L02,L03...L09,L10 (in this case checkbox
labels)
I want to set the captions via a lookup @ form open
the below blows before I can specify the control I wish to manipulate
Function lblr(LO As Object, pntr As String)
'LO.Caption = DLookup("ListLbl", "ListLabel", "Code=" & pntr)
'DLookup("ListLbl", "ListLabel", "Code = pntr")
LO.Caption = DLookup("ListLbl", "ListLabel", "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("ListLbl", "ListLabel", "Code='01'") '<<<This Works
For i = 2 To 10
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
....