I've got a form (frmSpreadsheet), which has two unbound textboxes (ctlRawDetHD1 and ctlRawDetHD2) that I am trying to populate using values from a query (CountRawDetectHD1). The ctlTagCode is bound to a table (FishCharacteristics) I get an error '2448', "You can't assign a value to this object". Here's the code I am using:
When I get the error and try to debug, If (Not IsNull(ctlTagCode)) Then Me![ctlRawDetHD1] = RawDetectHD1 is highlighted.
Any suggestions on where I've gone wrong?
Code:
Option Compare Database
Private Sub Form_Load()
Dim RawDetectHD1, RawDetectHD2 As Variant
RawDetectHD1 = DLookup("HDCount", "CountRawDetectHD1", "TagCode = [ctlTagCode]")
RawDetectHD2 = DLookup("HDCount", "CountRawDetectHD2", "TagCode = [ctlTagCode]")
If (Not IsNull(ctlTagCode)) Then Me![ctlRawDetHD1] = RawDetectHD1
If (Not IsNull(ctlTagCode)) Then Me![ctlRawDetHD2] = RawDetectHD2
End Sub
When I get the error and try to debug, If (Not IsNull(ctlTagCode)) Then Me![ctlRawDetHD1] = RawDetectHD1 is highlighted.
Any suggestions on where I've gone wrong?