[Zope] can't store a date in Access database

Micah Martin micah@objectmentor.com
Thu, 25 Oct 2001 13:59:03 -0500

I appologize for my careless typos.  I should have copied and pasted the
code.  Here is the copied text:
insert into TableName(Date) values ('10/25/2001')
The quotes were in fact single quotes.  
Yes the name of the table is really 'TableName', however this was just
created to help tackle my problem.  The real SQL statement has 20 fields to
fill.  I wanted to isolate the problem so I made a silly table named
You're right that I should not need a key for this test to work.  
I am sure the SQL is correct because it works fine in Java.  Just not in
Zope, it yeild the error:
Error, sql.error: ('37000', -3502, '[Microsoft][ODBC Microsoft Access
Driver] Syntax error in INSERT INTO statement.') 
From: "Thomas B. Passin" <tpassin@m...
Date: Thu Oct 25, 2001 4:29 pm
Subject: Re: [Zope] can't store a date in Access database

[Micah Martin]

> Whoops, this was a typo.  The code is actually:
> insert into TableName (Date) values ("10/24/2001")
> I'm still looking for a solution to the problem.

Is the name of your table really "TableName"?  This seems unusual.  You need
the actual name of the table.  You also probably need to supply the primary
key or index column value as  well as the date column - definitely if there
is a primary key or an index (there ought to be one, but in Access you can
get away without a primary key).

Finally, you need to use single quotes instead of double quotes around the
date value.  Double and single quotes are not interchangable in SQL.  So if
your table is called "fact_table", and its primary key or index column is
called "the_key" whose value should be 102 for this row, and if the date
field were called "Date", then you would write

insert into fact_table (the_key,Date) values (102,'10/24/2001')

Access will accept this syntax for a dattime field, as I just verified by

If you mean to be changing an existing date value, you need to use an update
statement instead.


Tom P