Validation Help

Debased

Registered User.
Local time
Today, 05:56
Joined
Mar 11, 2004
Messages
112
I have a main form with a date field I want to be filled in before the user proceeds.

I have searched the forum and found the following code which I have implemented however, no matter where I placed it it just keeps on allowing the cursor to move to the next field on the subform and allows the form to be closed also. It doesn't save the record because until the date field is completed, no record is created but I want it to stop the user, return to the date field and make them enter a date.

Private Sub AuditDate_BeforeUpdate(Cancel As Integer)
If IsNull(Me.AuditDate) Or Me.AuditDate = "" Then
MsgBox "You must enter a date!"
AuditDate.SetFocus
Exit Sub
End If
End Sub

Any ideas? thanks
 
Try If IsNull(Me.AuditDate) Or Me.AuditDate = "" Then
MsgBox "You must enter a date!"
docmd.cancelevent
End If
End Sub
 
thanks Keith that did it!
 

Users who are viewing this thread

Back
Top Bottom