G
GVR_Mike
This isn't returning the right answer. It's always returning "OLD" no
matter what the dates are.
If both Start and End date are older than a year then it should be "OLD"
If Start date is older than a year & End date is younger then its "BOTH"
If both Start & End are younger than a year then it's "NEW"
If Format(Me.TxtStart, "mm/dd/yyyy") > DateAdd("yyyy", 1, Date) And _
Format(Me.TxtEnd, "mm/dd/yyyy") > DateAdd("yyyy", 1, Date) Then
MsgBox "OLD"
ElseIf Format(Me.TxtStart, "mm/dd/yyyy")> DateAdd("yyyy", 1, Date) And _
Format(Me.TxtEnd, "mm/dd/yyyy") <= DateAdd("yyyy", 1, Date) Then
MsgBox "BOTH"
ElseIf Format(Me.TxtStart, "mm/dd/yyyy")<= DateAdd("yyyy",1, Date) And _
Format(Me.TxtEnd, "mm/dd/yyyy") <= DateAdd("yyyy", 1, Date) Then
MsgBox "NEW"
End If
Thanks
DS
The Format function returns a string. It appears that your string is
evaluating to be "greater than" your date so it always returns OLD.
I'd try comparing the date directly from the textbox like instead of
formatting it. See http://www.techonthenet.com/access/functions/date/format.php