SQL question: confused about dates

Z

zladnaj

I'm creating an Access db for a student project, but I've hit a snag. I
have to use SQL insert statements.

I have defined the 2nd and 3rd fields in a table as a DATE data type.

Here is my statement:
INSERT INTO TRIP
VALUES (263,2005-01-18,2005-01-19,'Phoenix','AZ','4023892991',3);

But when I then go to the table, Access renders it like this:

263 | 6/8/1905 | 6/7/1905 | Phoenix | AZ | 4023892.......

Does anyone know how I express my date values in my SQL statement so
that they look like US-English dates, i.e. (1/18/05)?

Or, is the problem with the data definition - that I've defined these
fields as the DATE data type when they should be something else?
 
C

Chris2

zladnaj said:
I'm creating an Access db for a student project, but I've hit a snag. I
have to use SQL insert statements.

I have defined the 2nd and 3rd fields in a table as a DATE data type.

Here is my statement:
INSERT INTO TRIP
VALUES (263,2005-01-18,2005-01-19,'Phoenix','AZ','4023892991',3);

Try:
INSERT INTO TRIP
VALUES (263,"2005-01-18","2005-01-19",'Phoenix','AZ','4023892991',3);
But when I then go to the table, Access renders it like this:

263 | 6/8/1905 | 6/7/1905 | Phoenix | AZ | 4023892.......

Go to Tools>Macro>Visual Basic Editor.

Go to View>Immediate Window

In the Immediate Window, attempt two experiments. Type, exactly as
follows, and hit enter:

? CDate(2005-01-18)

And you get: 06/08/1905

Type, exactly, and hit enter:

? CDate("2005-01-18")

And you get: 01/18/2005
 
V

Van T. Dinh

....
VALUES (263,#01/18/2005#,#01/19/2005#,'Phoenix','AZ','4023892991',3)

Explicit date values must be in US format mm/dd/yyyy and enclosed in hashes.
 
Top