Results 1 to 3 of 3

Thread: SQL in VB6 for Access file with dates

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 1999
    Location
    Littlehampton, W Sussex GB
    Posts
    203

    Post

    I am using an sql to select records from an Access file and need to know what format the database expects dates in - it seems to be mm/dd/yy is there any way i can change this to dd/mm/yy?? Because this is how it is entered via the DTPicker. Thanks

  2. #2
    Addicted Member
    Join Date
    Oct 1999
    Posts
    232

    Post

    When you specify the criteria argument, date literals must be in U.S. format, even if you're not using the U.S. version of the Microsoft Jet database engine. For example, May 10, 1996, is written 10/5/96 in the United Kingdom and 5/10/96 in the United States. Be sure to enclose your date literals with the number sign (#) as shown in the following examples.

    To find records dated May 10, 1996 in a United Kingdom database, you must use the following SQL statement:

    SELECT *
    FROM Orders
    WHERE ShippedDate = #5/10/96#;

    You can also use the DateValue function which is aware of the international settings established by Microsoft Windows. For example, use this code for the United States:

    SELECT *
    FROM Orders
    WHERE ShippedDate = DateValue('5/10/96');

    And use this code for the United Kingdom:

    SELECT *
    FROM Orders
    WHERE ShippedDate = DateValue('10/5/96');

    ------------------
    smalig
    [email protected]
    smalig.tripod.com

  3. #3
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    Don't know if it's an option bbut you can change the date format in the DTP control (dataformat property, I believe)

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