G
Guest
Hi,
I have a form with two textboxes for entering a date range. When the user
clicks OK on the form, i validate that the texboxes are dates... this works
fine... then I want to check that the from date is not greater than the to
date, but it is not working consitently. My message is returning that my from
date is greater that my to date even when it isn't. sample code:
If Not IsDate(tbxFrom_Date.Value) Then
MsgBox "The value entered in the From Date field is not a valid Date"
tbxFrom_Date.SetFocus
ElseIf Not IsDate(tbxTo_Date.Value) Then
MsgBox "The value entered in the To Date field is not a valid Date"
tbxTo_Date.SetFocus
ElseIf tbxFrom_Date > tbxTo_Date Then
MsgBox "The From Date is greater than the To Date. Please change. "
& _
tbxFrom_Date.Value & " - " & tbxTo_Date.Value
tbxFrom_Date.SetFocus
tbxFrom_Date.Value = ""
Else
'MsgBox "all good"
Unload Me
End If
when I read at my resulting message, the from date is definitely less than
the to date...
ideas?
I have a form with two textboxes for entering a date range. When the user
clicks OK on the form, i validate that the texboxes are dates... this works
fine... then I want to check that the from date is not greater than the to
date, but it is not working consitently. My message is returning that my from
date is greater that my to date even when it isn't. sample code:
If Not IsDate(tbxFrom_Date.Value) Then
MsgBox "The value entered in the From Date field is not a valid Date"
tbxFrom_Date.SetFocus
ElseIf Not IsDate(tbxTo_Date.Value) Then
MsgBox "The value entered in the To Date field is not a valid Date"
tbxTo_Date.SetFocus
ElseIf tbxFrom_Date > tbxTo_Date Then
MsgBox "The From Date is greater than the To Date. Please change. "
& _
tbxFrom_Date.Value & " - " & tbxTo_Date.Value
tbxFrom_Date.SetFocus
tbxFrom_Date.Value = ""
Else
'MsgBox "all good"
Unload Me
End If
when I read at my resulting message, the from date is definitely less than
the to date...
ideas?