Results 1 to 2 of 2

Thread: Exception occurred ... and Date question

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2001
    Location
    Alberton, Gauteng, South-Africa
    Posts
    48

    Question

    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
    ;-)
    Jaco
    South-Africa

  2. #2
    Guest
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width