Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Location
    San Diego
    Posts
    45

    Unanswered: evaluating dates

    If I am evaluating two dates, as in the following statement:

    Code:
    If DLookup("Friday", "qryGetFridayDate") = Now() Then
    do something
    and the date stored in "Friday" is a short date displaying ##/##/####, and now() displays the date and time, what do I do to get the expression to only look at the day itself and not the time? Otherwise, this statement will never evaluate to true.

    Thanks a bunch!

  2. #2
    Join Date
    Aug 2004
    Posts
    7
    try
    If DLookup("Friday", "qryGetFridayDate") = cvdate(format(Now(),"yyyy/mm/dd")) Then

  3. #3
    Join Date
    Mar 2004
    Location
    San Diego
    Posts
    45
    I get a run time error that simply says "overflow" when I try the CVDate(). Any other suggestions?

    Thanks

  4. #4
    Join Date
    Aug 2004
    Posts
    7
    try print now()
    print format(now(),"yyyy/mm/dd")
    print cvdate(format(now(),"yyyy/mm/dd"))
    And show me which one fails.

    Also show me the results of the dlookup

  5. #5
    Join Date
    Mar 2004
    Location
    San Diego
    Posts
    45

    Doh!

    I just had a big "Doh!!!" moment, and realized that I can use Date() for my comparison and it will only evaluate the short date.

    By the way, the reason why the code failed is because I neglected to include the ""s around the yyyy/mm/dd. Nothing at all to do with your suggestion!

    Thanks for your help!

Posting Permissions

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