Hi,
We're constructing a website using ASP and VBScript and
pulling data from a database that is date specific.
The below error checking code works for all dates within a particular year but if you change the year value where the variable DateTo is still < DateFrom an error message is displayed!
Also tried comparing DateValue(DateTo) DateValue(DateFrom) but we got the error every time then. We tested and it seemed to confirm that the if DD/MM < DD2/MM2 was true then process irrespective of the year (YY) value.
if (isDate(DateFrom) = True) and (isDate(DateTo)=True) then
if (DateTo < DateFrom) Then
StrError = StrError &"<br>Date to is before date from"
NoError = NoError + 1
elseif (DateValue(DateTo) < DateValue(DateFrom) and TimeValue(DateTo) < TimeValue(DateFrom)) Then
StrError = StrError &"<br>Date to is before date from"
NoError = NoError + 1
end if
end if
Any suggestions would be greatly appreciated thanks..
Regards
Gavin
We're constructing a website using ASP and VBScript and
pulling data from a database that is date specific.
The below error checking code works for all dates within a particular year but if you change the year value where the variable DateTo is still < DateFrom an error message is displayed!
Also tried comparing DateValue(DateTo) DateValue(DateFrom) but we got the error every time then. We tested and it seemed to confirm that the if DD/MM < DD2/MM2 was true then process irrespective of the year (YY) value.
if (isDate(DateFrom) = True) and (isDate(DateTo)=True) then
if (DateTo < DateFrom) Then
StrError = StrError &"<br>Date to is before date from"
NoError = NoError + 1
elseif (DateValue(DateTo) < DateValue(DateFrom) and TimeValue(DateTo) < TimeValue(DateFrom)) Then
StrError = StrError &"<br>Date to is before date from"
NoError = NoError + 1
end if
end if
Any suggestions would be greatly appreciated thanks..
Regards
Gavin