Results 1 to 3 of 3

Thread: SQL

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 1999
    Location
    Belgium
    Posts
    98

    Post

    Hi,
    I have a date problem with a SQL statement.

    example

    Dim MyDate1 as date
    Dim MyDate2 as date

    MyDate1 = "09/12/99"
    Mydate1 = Format(MyDate1, "DD/MM/YY")

    MyDate2 = (MyDate1 + 3)
    Mydate2 = Format(MyDate2, "DD/MM/YY")

    Then I write an SQL (Select * from ... between MyDate1 and MyDate2)statement that selects a recordset between the 2 dates, but I always get a recordset that begins at 12/09/99
    (12 september 1999).

    Why does this happen ?

    R@emdonck

  2. #2
    Lively Member Ishamel's Avatar
    Join Date
    Nov 1999
    Location
    Edinburgh, Scotland
    Posts
    112

    Post

    I had a similar problem not too long ago.

    Even though the date format of the SQL Server database was set as UK format, when the 'dd' section was 12 or less, the database would assume I had entered a US format date.

    To get round this try formatting the date as dd/mmm/yy.

    Code:
    myDate1 = Format(myDate1, "dd/mmm/yy")
    ------------------
    Ishamel
    [email protected]


  3. #3
    New Member
    Join Date
    Oct 1999
    Location
    Amersfoort
    Posts
    15

    Post

    If you have msaccess, you can make your one query, just make a new query and select SQL under view. Tada! your SQL statement

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