INSERT query fails with date field 
Author Message
 INSERT query fails with date field

Dear all,

I am using INSERT to create a new record from a VB5 module to a local
Access97 database table. I create a Database object, Open it with the path
of the Access database and Execute the query. I can update Number and Text
fields fine, using something like:

"INSERT INTO TableName (TextField1) VALUES  ('Some Text to go in

However I cannot input data in Date/Time fields in the Access table. The
queries I have tried so far are:

"INSERT INTO TableName (Date) VALUES  ({d '01/05/98'})"
"INSERT INTO TableName (Date) VALUES  (#01/05/98#)"
"INSERT INTO TableName (Date) VALUES  ('#01/05/98#')"
"INSERT INTO TableName (Date) VALUES  ('01/05/98')"

None of these work, I get an SQL syntax error. I seem to be missing some
obsucre syntax convention of SQL/VB/Access/JET.

Can anyone tell me what I should be using to make this work please?


Mon, 23 Oct 2000 03:00:00 GMT  
 INSERT query fails with date field


Realised my dumb-ass mistake - DATE is a reserved word in ANSI SQL. Changed
the field name to "EventDate" and now works fine.

Mon, 23 Oct 2000 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Excel 2000: Using INSERT statement in QueryTable query fails

2. Update of date field to null fails

3. inserting character in an access field by using an update query

4. Inserting current date into a contact's note field

5. Insert current date into form fields

6. Insert date and time field into MS Access with SQL

7. COM+ Insert fails, ASP Insert Ok

8. Problem inserting record with date field

9. INSERT INTO and UPDATE date field

10. Inserting a date field into SQL

11. Insert fails with a large insert?.?

12. How to Insert a Record with a Date Field into FoxPro


Powered by phpBB® Forum Software