If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Unanswered: Validating Dates in a text box

I'm trying to validate and end date field on a form. I have the following if statement on the field after the End Date:

Private Sub End_Time_BeforeUpdate(Cancel As Integer)
If (Me.EndDate < Me.StartDate) Then
MsgBox "End Date should be greater than or equal to Start Date"
Cancel = True
End If
End Sub

The message box will pop up if my End Date is less than the Start Date field, but it also pops up if the End Date is equal to the Start Date. Shouldn't the "<" keep that from happening? Please correct me if I'm wrong.

Re: Validating Dates in a text box

Originally posted by Decemuirs
I'm trying to validate and end date field on a form. I have the following if statement on the field after the End Date:

Private Sub End_Time_BeforeUpdate(Cancel As Integer)
If (Me.EndDate <= Me.StartDate) Then
MsgBox "End Date should be greater than or equal to Start Date"
Cancel = True
End If
End Sub

The message box will pop up if my End Date is less than the Start Date field, but it also pops up if the End Date is equal to the Start Date. Shouldn't the "<=" keep that from happening? Please correct me if I'm wrong.