Need help to clear a form field

vaidehikumar

Registered User.
Local time
Today, 12:19
Joined
Apr 17, 2012
Messages
25
:o I have this code:

Private Sub Job_Number_BeforeUpdate(Cancel As Integer)
If IsNull(DLookup("[Job Number]", "Job", "[Job Number]= " & Me.[Job Number] & " ")) Then
MsgBox "Job Number doesn't exist Enter a job number that already exist."
Me.[Job Number].Undo
Cancel = True
End If
End Sub

It is not clearing the Job Number Field, and also it is not letting me to close the form without entering the Job number that already exist. If I try to close the form without entering the job number it gives me run time error " syntax error (missing operator) query expression '[Job Number] = '."
 
I am sorry I do not understand when you say move the code to BeforeUpdate event. I thought I have the code within BeforeUpdate event. Thank you for your assistance.
 

Users who are viewing this thread

Back
Top Bottom