This is driving me insaaaaane. I've spent the better part of the day Googling variations of this and nothing I've found has really helped.
I have a subform that is based on another subform inside a main form (so 3 forms total). I want to do a DMax default value in VBA to autonumber the *new* next record on form 3 before it is entered, and have the following:
Run-time error '3075': Syntax error (missing operator in query expression '[pkNumber] ='.
I think this is probably relatively simple and is due to my using the incorrect quotes or syntax for an integer?
My code is:
And the line the debugger is highlighting is:
SOS! Thx...
I have a subform that is based on another subform inside a main form (so 3 forms total). I want to do a DMax default value in VBA to autonumber the *new* next record on form 3 before it is entered, and have the following:
Run-time error '3075': Syntax error (missing operator in query expression '[pkNumber] ='.
I think this is probably relatively simple and is due to my using the incorrect quotes or syntax for an integer?
My code is:
Code:
Dim strParentDocName As String
Dim x As Integer
x = DMax("[Inspection_Number]", "[tblInspectionData]", "[pkNumber] =" & [Forms]![frmPermitEntry]![subfrmThirdPartyData]![ctlpkNumber])
If IsNull(x) Then
Me.ctlInspectionNumber.DefaultValue = 1
Else
Me.ctlInspectionNumber.DefaultValue = x + 1
End If
And the line the debugger is highlighting is:
Code:
x = DMax("[Inspection_Number]", "[tblInspectionData]", "[pkNumber] =" & [Forms]![frmPermitEntry]![subfrmThirdPartyData]![ctlpkNumber])
SOS! Thx...