I am trying to do a validation check on dates entered by my users. This date can not be greater than today’s date. The problem is comparing the whole date (MM/DD/YYYY)
Example Values Current date = ‘07/13/2005’
Input Date1 = ‘07/13/2050’
Input Date2 = ‘07/11/2050’
When I compare (InputDate1 to Current Date) I receive my Validation Message, but when I compare (InputDate2 to Current Date) I do not receive any validation error. My code seems to think that InputDate2 is less than the Current Date because the InputDate2(day) is less the Current Date(day).
Here’s my actual code
If FORMATDATE$(rslll(“issue_date”).value) > FORMATDATE$(Now()) then
MSGBOX “The Issue date can not be greater than today’s date.”
ValidationCheck = False
Else
ValidationCheck = True
End If
Has anyone else had this problem? Are there any solutions? I could convert the dates to Julian date, but I hoping that there might be an easier way.
Example Values Current date = ‘07/13/2005’
Input Date1 = ‘07/13/2050’
Input Date2 = ‘07/11/2050’
When I compare (InputDate1 to Current Date) I receive my Validation Message, but when I compare (InputDate2 to Current Date) I do not receive any validation error. My code seems to think that InputDate2 is less than the Current Date because the InputDate2(day) is less the Current Date(day).
Here’s my actual code
If FORMATDATE$(rslll(“issue_date”).value) > FORMATDATE$(Now()) then
MSGBOX “The Issue date can not be greater than today’s date.”
ValidationCheck = False
Else
ValidationCheck = True
End If
Has anyone else had this problem? Are there any solutions? I could convert the dates to Julian date, but I hoping that there might be an easier way.