Date compare not working

stretch66

Racing towards the start
Local time
Today, 13:03
Joined
Sep 28, 2005
Messages
72
Hi,

Can anyone tell me what I have done wrong here please as I cannot get it to work.


Private Sub dateTO_Change()
If Me.dateTo < Me.dateSTART Then
MsgBox "The date you have entered is and earlier date than the Start Date"
Cancel = True
End If
End Sub

Thanks
 
Are your fields date fields??? If they are text fields then this comparison may go broke...

Try using Datevalue or DateSerial function to make the texts " real dates "

Good luck
 
the change event occurs on every keystroke. consider using the before update event.
 

Users who are viewing this thread

Back
Top Bottom