Adam McReynolds
Registered User.
- Local time
- Today, 02:15
- Joined
- Aug 6, 2012
- Messages
- 129
I keep getting an error '3075' syntax error(missing operator) in query expression 'prikey =' . My code runs fine when I first enter in the number but when I take the number out the After Update code runs again and produces this error.
I have 3 unbound textboxes: txt_rid1, txt_sn1, and txt_incoming1
My prikey field is a auto number
The debugger keeps focusing on this: "prikey = " & Me.txt_rid1 & "" , but what I don't get is how does it run fine on entering data but not removing it?
Any help would be much appreciated.
I have 3 unbound textboxes: txt_rid1, txt_sn1, and txt_incoming1
My prikey field is a auto number
The debugger keeps focusing on this: "prikey = " & Me.txt_rid1 & "" , but what I don't get is how does it run fine on entering data but not removing it?
Code:
Private Sub txt_rid1_AfterUpdate()
'Field Line 1
If IsNull(Me.txt_rid1) Or Me.txt_rid1 = "" Then
Me.txt_sn1 = ""
Me.txt_incoming1 = ""
End If
If DCount("prikey", "tbl_module_repairs", "prikey = " & Me.txt_rid1 & "") = 0 Then
Me.txt_rid1 = ""
Me.txt_sn1 = ""
Me.txt_incoming1 = ""
Me.txt_rid1.SetFocus
MsgBox "Please Enter a Valid Report ID for Field 1 "
Cancel = True
Exit Sub
End If
Me.txt_sn1 = DLookup("incoming_module_sn", "tbl_module_repairs", "prikey = " & Me.txt_rid1 & "")
Me.txt_incoming1 = DLookup("incoming_disposition", "tbl_module_repairs", "prikey = " & Me.txt_rid1 & "")
Me.Refresh
End Sub
Any help would be much appreciated.