Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Querying Access Dates with Leading Zeros

  • 06-01-2005 01:29PM
    #1
    Registered Users, Registered Users 2 Posts: 604 ✭✭✭


    Hi

    I have come across a strange symptom in one of my Queries. Im running quite a long SQL query on an access DB from an asp page, the problem is in the Where clause :

    WHERE (Weekend=#18/09/2004# OR Weekend=#25/09/2004# OR Weekend=#02/10/2004# OR Weekend=#09/10/2004# Or Weekend=#16/10/2004# OR Weekend=#23/10/2004# OR Weekend=#30/10/2004#)


    It finds all dates that have a day part higher than 9 just fine e.g. 12/12/2004.

    but on dates where the day part has a leading 0 it wont find anything for them e.g. 02/10/2004

    i have the local settings on the ASP page set to UK so it is in the same format. The Dates in the DB are identical to the date im passing in but it still wont find ones with leading Zeros ??


    Anyone seen this before ?


Comments

  • Registered Users, Registered Users 2 Posts: 1,452 ✭✭✭tomED


    It's been a long time since I had this problem, as I try and avoid access at all costs for websites!

    There were two things I used to try:

    Session.LCID = 2058 (which I think you have already set)

    Or if the search is dynamic, rearranging the dates to mm/dd/yyyy instead of dd/mm/yyyy.

    Hope this helps.... :)


  • Registered Users, Registered Users 2 Posts: 604 ✭✭✭Kai


    Yea turns out that Access was displaying the dates in UK format but they were actually stored in US format. How messed up is that, youd never know until you ran a query and checked your results.

    Anyway re-arranging the dates in asp before running the Query sorted it out. Unfortunatly im stuck with Access for the time being.


  • Registered Users, Registered Users 2 Posts: 706 ✭✭✭DJB


    Dates and access are a pain in the arse!

    Work with ms sql and convert your dates to 20050114 format and you should have no problems. I think you can do the same with access.

    :)


Advertisement