PDA

Click to See Complete Forum and Search --> : Exception occurred ... and Date question


Randhart
Feb 8th, 2001, 03:09 AM
Hi Again!

What does this mean?
**
error '80020009'
Exception occurred.
**

Here's the code that caused it
**
if trim(rsResults("Rate_Date")) = FormatDateTime(Now ,vbShortDate) then
Response.write "Test Suceeded"
else
Response.write "try Again<br>"
end if
**

Also i want to compare a date in the format of 08/02/2001 but the best I can get with the FormatDateTime is 2/8/001 .. how can i get the format of the date to the one I want.

Regards and TIA

Feb 9th, 2001, 11:42 AM
You might try wrapping the parts of your conditional with the CDate function to ensure that you're comparing dates.

trim(rsResults("Rate_Date")) = FormatDateTime(Now ,vbShortDate)

to

CDate(trim(rsResults("Rate_Date"))) = CDate(FormatDateTime(Now ,vbShortDate))

I know of two ways to get the date format you want, and neither is very pretty. One is to make your own date formatting function that uses the Day, Month, and Year functions to compose your own format. The other is to wrap the Format$ function from VB in an ActiveX Dll and call it from your ASP.


Paul