Access Date Format

JAM

Member
Joined
Mar 9, 2003
Messages
24
Hi Every One
I have set the date format to d/M/yyyy in both VB and Access.
But when quering access from VB it seems that Acess is acting like if the format is like M/d/yyyy. Any Idea? please help.
 
Access uses this format internal. You can try and create a query in the editor and the change to sql-view. The datestring in the sql-statement will be in the format of m/d/y.
So you will have to put your date into the propper format before assembling your sql-commands in vb.
 
Why not do any queries in SQL using its RAW form i.e. as a double

heres an example

Code:
SQL = "SELECT * FROM MyTable WHERE AppointmentDate = " & Today.ToOADate

This if of course the database, table and fields existed would get all appointments for today.

Heres an example for getting the RAW double for the 01/12/2002 and using the previous SQL

Code:
Dim MyDate As Date = "01/12/2002"
SQL = "SELECT * FROM MyTable WHERE AppointmentDate = " & MyDate.ToOADate


Hope this helps

Andy
 
I get date from a dateTimePicker. It works fine if the selected date is the 3oth of any month.
 
Back
Top