PDA

Click to See Complete Forum and Search --> : SQL


R@emdonck
Dec 12th, 1999, 03:31 PM
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

Ishamel
Dec 12th, 1999, 03:41 PM
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.


myDate1 = Format(myDate1, "dd/mmm/yy")


------------------
Ishamel
KBurt59082@AOL.COM

PietHein
Dec 12th, 1999, 08:01 PM
If you have msaccess, you can make your one query, just make a new query and select SQL under view. Tada! your SQL statement