Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2007
    Posts
    6

    Smile Unanswered: Trouble running a query with date criteria!

    Hi. I sure hope someone can help, or I won't be sleeping tonight. I'm have to run a query that draws from two relational tables. The criteria I need to use is a date. I got one hint that the language set U.S. vs. Can. has something to do with it, and have tried both languages as Microsoft program defaults, without success. I would be most grateful if someone could help me with this.

  2. #2
    Join Date
    Jan 2007
    Location
    California, USA
    Posts
    520
    Show us what you are actually trying to do. The code you have used so far. How are you trying to get the date into the query criteria?

    You do need to know that the date generally needs to be formatted in USA date format, MM/DD/YYYY.

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Post the SQL you have tried so far
    George
    Home | Blog

  4. #4
    Join Date
    Nov 2007
    Posts
    6
    Hi. I have formatted the date to be mm/dd/yyyy, but I cannot enter it as such. I have to enter as dd/mm/yyyy in the Design view in order for it to show up as mm/dd/yyyy on the datasheet view. I know this is going to be a problem for others trying to enter anything onto any database I create. Someone did say that they had to change something on their computer to American format, but I've already done that through the control panel. Any other ideas?

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    when using dates in queries, its always a good idea to bracket them with the hash symbol #

    eg
    select <mydatevalue> from <mytable> where <mydatevalue> = "#02 Dec 2007#"
    OR
    select <mydatevalue> from <mytable> where <mydatevalue> = "#12/02/2007#"

    you can always change vlaues in a query by using an explicit foramt statement
    say you have a control on your form with a date in called mydatecontrol

    select <mydatevalue> from <mytable> where <mydatevalue> = "#" & format(mydatecontrol,"mm/dd/yyyy") & "#"

    as to how that plays int he datasheet view I'm not too sure.. primarily because I don't use the datasheet view in any apps I develop.. although they aren't quite the spawn of the devil that most domain functions are, they are gettign pretty close. The price for the familiar 'spreadsheet' dislay is just too high.

  6. #6
    Join Date
    Nov 2007
    Posts
    6

    Thanks. I'll try that tomorrow.

    Thanks. I'll try that tomorrow.

Posting Permissions

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