date validation

jedder18

Just Livin the Dream!
Local time
Yesterday, 16:50
Joined
Mar 28, 2012
Messages
135
Searching the forums, getting more confused..LOL! :confused:

This should be simple code, brain won't allow me to think today.

Using Access 2007

Have a DOB (date of birth) field in table.
On field entry, I need to make sure the entry is not in the future.

Properties of field in Before Update?
Validation?

Any help, much appreciated.
 
Code:
Private Sub yourDOBControlName_BeforeUpdate(Cancel As Integer)
    If Me.yourDOBControlName > Date() Then
        Msgbox "Are you kidding me? Unless you have a time machine; " & _
               "there is no way in hell you have a future dated b'day..", vbInformation, "Check again !!"
        Cancel = True
    End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom