# Miscellaneous > Database Programming >  Inserting Dates in Access with a field defined as a date/time field

## Nathaniel Tucker

I am having problems adding & updating records with dates and times.  My code is as follows:

Set MyDb = Server.CreateObject(&#34;AspDB.Pro&#34 :Wink: 
MyDb.dbmdb=Server.MapPath(&#34;/databases/calendars/calendars.mdb&#34 :Wink: 
MyDb.dbMode=&#34;both&#34;
MyDb.dbUnit=1
MyDb.dbGridInc=20 
MyDb.dbGridDisplayFlds=&#34;Date,Event&#34;
MyDb.dbFormDisplayFlds=&#34;Date,Event,Place,Time,  Contact,Email,Semester,Text&#34;
MyDb.dbNavigation=&#34;bottom&#34;
MyDb.dbStatusBar=False
MyDb.dbNavigationItem=&#34;top,bottom,prev,next,ad  d,update,reload&#34;
MyDb.dbMemoTextSize=&#34;-1&#34;
MyDb.dbEditHideFlds=&#34;Index,Category&#34;
MyDb.dbEditUpdateROFlds=&#34;Index,Category&#34;
Mydb.dbEditFlds   = &#34;Date,Event,Place,Time,Contact,Email,Catego  ry[Events],Semester,Text&#34;
EP = &#34;TableName=Q_Update_Event, BookMarkFlds=Index, TableTag=Border=0&#34;
EP = EP & &#34;, size200=1x75, inputsize=5x75&#34;
EP = EP & &#34;, RecordScope=single&#34;
MyDb.dbEditParams = EP
MyDb.dbGridIndex=&#34;False&#34;
MyDb.dbMagicCell=&#34;Event,,#Event#,index,indexan  chor;&#34;
MyDb.dbSQL=&#34;Select * FROM [Q_Update_Event]&#34;
MyDb.aspDBPro
-------------------------
This is the error that I am getting:

Error # = 80040E14
Description = [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
Source = Microsoft OLE DB Provider for ODBC Drivers
SQL State = 37000
NativeError = -3502

----------


## Frank

Just taking a quick look at your problem. &#34;Index&#34; is a reserved word and that should be enough to mess you up. Change that firld name to something else first and if still have problem, turn on the debug and look at theEdit SQL statement.


Fk



------------
Nathaniel Tucker at 12/8/99 5:01:23 PM

I am having problems adding & updating records with dates and times.  My code is as follows:

Set MyDb = Server.CreateObject(&#34;AspDB.Pro&#34 :Wink: 
MyDb.dbmdb=Server.MapPath(&#34;/databases/calendars/calendars.mdb&#34 :Wink: 
MyDb.dbMode=&#34;both&#34;
MyDb.dbUnit=1
MyDb.dbGridInc=20 
MyDb.dbGridDisplayFlds=&#34;Date,Event&#34;
MyDb.dbFormDisplayFlds=&#34;Date,Event,Place,Time,  Contact,Email,Semester,Text&#34;
MyDb.dbNavigation=&#34;bottom&#34;
MyDb.dbStatusBar=False
MyDb.dbNavigationItem=&#34;top,bottom,prev,next,ad  d,update,reload&#34;
MyDb.dbMemoTextSize=&#34;-1&#34;
MyDb.dbEditHideFlds=&#34;Index,Category&#34;
MyDb.dbEditUpdateROFlds=&#34;Index,Category&#34;
Mydb.dbEditFlds   = &#34;Date,Event,Place,Time,Contact,Email,Catego  ry[Events],Semester,Text&#34;
EP = &#34;TableName=Q_Update_Event, BookMarkFlds=Index, TableTag=Border=0&#34;
EP = EP & &#34;, size200=1x75, inputsize=5x75&#34;
EP = EP & &#34;, RecordScope=single&#34;
MyDb.dbEditParams = EP
MyDb.dbGridIndex=&#34;False&#34;
MyDb.dbMagicCell=&#34;Event,,#Event#,index,indexan  chor;&#34;
MyDb.dbSQL=&#34;Select * FROM [Q_Update_Event]&#34;
MyDb.aspDBPro
-------------------------
This is the error that I am getting:

Error # = 80040E14
Description = [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
Source = Microsoft OLE DB Provider for ODBC Drivers
SQL State = 37000
NativeError = -3502

----------


## Nathaniel Tucker

I made that change, but still having problems...getting the same error.

Thanks,

nate


------------
Frank at 12/8/99 11:37:37 PM

Just taking a quick look at your problem. &#34;Index&#34; is a reserved word and that should be enough to mess you up. Change that firld name to something else first and if still have problem, turn on the debug and look at theEdit SQL statement.


Fk



------------
Nathaniel Tucker at 12/8/99 5:01:23 PM

I am having problems adding & updating records with dates and times.  My code is as follows:

Set MyDb = Server.CreateObject(&#34;AspDB.Pro&#34 :Wink: 
MyDb.dbmdb=Server.MapPath(&#34;/databases/calendars/calendars.mdb&#34 :Wink: 
MyDb.dbMode=&#34;both&#34;
MyDb.dbUnit=1
MyDb.dbGridInc=20 
MyDb.dbGridDisplayFlds=&#34;Date,Event&#34;
MyDb.dbFormDisplayFlds=&#34;Date,Event,Place,Time,  Contact,Email,Semester,Text&#34;
MyDb.dbNavigation=&#34;bottom&#34;
MyDb.dbStatusBar=False
MyDb.dbNavigationItem=&#34;top,bottom,prev,next,ad  d,update,reload&#34;
MyDb.dbMemoTextSize=&#34;-1&#34;
MyDb.dbEditHideFlds=&#34;Index,Category&#34;
MyDb.dbEditUpdateROFlds=&#34;Index,Category&#34;
Mydb.dbEditFlds   = &#34;Date,Event,Place,Time,Contact,Email,Catego  ry[Events],Semester,Text&#34;
EP = &#34;TableName=Q_Update_Event, BookMarkFlds=Index, TableTag=Border=0&#34;
EP = EP & &#34;, size200=1x75, inputsize=5x75&#34;
EP = EP & &#34;, RecordScope=single&#34;
MyDb.dbEditParams = EP
MyDb.dbGridIndex=&#34;False&#34;
MyDb.dbMagicCell=&#34;Event,,#Event#,index,indexan  chor;&#34;
MyDb.dbSQL=&#34;Select * FROM [Q_Update_Event]&#34;
MyDb.aspDBPro
-------------------------
This is the error that I am getting:

Error # = 80040E14
Description = [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
Source = Microsoft OLE DB Provider for ODBC Drivers
SQL State = 37000
NativeError = -3502

----------


## Nathaniel Tucker

Here is my code.... It won&#39;t allow me to key in a date into the record.  The actual Access 97 record is set to type &#39;Date/Time&#39;.  If I leave that field blank, it works fine, but errors when there is data entered. Any help would be appreciated:

<%
Set MyDb = Server.CreateObject(&#34;AspDB.Pro&#34 :Wink: 
MyDb.dbmdb=Server.MapPath(&#34;/databases/calendars/calendars.mdb&#34 :Wink: 
MyDb.dbMode=&#34;both&#34;
MyDb.dbUnit=1
MyDb.dbGridInc=20 
MyDb.dbGridDisplayFlds=&#34;Date,Event&#34;
MyDb.dbFormDisplayFlds=&#34;Date,Event,Place,Time,  Contact,Email,Semester,Text&#34;
MyDb.dbNavigation=&#34;bottom&#34;
MyDb.dbStatusBar=False
MyDb.dbNavigationItem=&#34;top,bottom,prev,next,ad  d,update,reload&#34;
MyDb.dbMemoTextSize=&#34;-1&#34;
MyDb.dbEditHideFlds=&#34;KIndex,Category&#34;
MyDb.dbEditUpdateROFlds=&#34;KIndex,Category&#34;
Mydb.dbEditFlds   = &#34;Date,Event,Place,Time,Contact,Email,Catego  ry [Events],Semester,Text&#34;
    EP = &#34;TableName=Q_Update_Event, BookMarkFlds=KIndex, TableTag=Border=0&#34;
    EP = EP & &#34;, size200=1x75, inputsize=5x75&#34;
    EP = EP & &#34;, RecordScope=single&#34;
MyDb.dbEditParams = EP
MyDb.dbGridIndex=&#34;False&#34;
MyDb.dbMagicCell=&#34;Event,,#Event#,index,indexan  chor;&#34;
MyDb.dbSQL=&#34;Select * FROM [Q_Update_Event]&#34;
MyDb.aspDBPro
%>


------------
Nathaniel Tucker at 12/9/99 8:52:49 AM

I made that change, but still having problems...getting the same error.

Thanks,

nate


------------
Frank at 12/8/99 11:37:37 PM

Just taking a quick look at your problem. &#34;Index&#34; is a reserved word and that should be enough to mess you up. Change that firld name to something else first and if still have problem, turn on the debug and look at theEdit SQL statement.


Fk



------------
Nathaniel Tucker at 12/8/99 5:01:23 PM

I am having problems adding & updating records with dates and times.  My code is as follows:

Set MyDb = Server.CreateObject(&#34;AspDB.Pro&#34 :Wink: 
MyDb.dbmdb=Server.MapPath(&#34;/databases/calendars/calendars.mdb&#34 :Wink: 
MyDb.dbMode=&#34;both&#34;
MyDb.dbUnit=1
MyDb.dbGridInc=20 
MyDb.dbGridDisplayFlds=&#34;Date,Event&#34;
MyDb.dbFormDisplayFlds=&#34;Date,Event,Place,Time,  Contact,Email,Semester,Text&#34;
MyDb.dbNavigation=&#34;bottom&#34;
MyDb.dbStatusBar=False
MyDb.dbNavigationItem=&#34;top,bottom,prev,next,ad  d,update,reload&#34;
MyDb.dbMemoTextSize=&#34;-1&#34;
MyDb.dbEditHideFlds=&#34;Index,Category&#34;
MyDb.dbEditUpdateROFlds=&#34;Index,Category&#34;
Mydb.dbEditFlds   = &#34;Date,Event,Place,Time,Contact,Email,Catego  ry[Events],Semester,Text&#34;
EP = &#34;TableName=Q_Update_Event, BookMarkFlds=Index, TableTag=Border=0&#34;
EP = EP & &#34;, size200=1x75, inputsize=5x75&#34;
EP = EP & &#34;, RecordScope=single&#34;
MyDb.dbEditParams = EP
MyDb.dbGridIndex=&#34;False&#34;
MyDb.dbMagicCell=&#34;Event,,#Event#,index,indexan  chor;&#34;
MyDb.dbSQL=&#34;Select * FROM [Q_Update_Event]&#34;
MyDb.aspDBPro
-------------------------
This is the error that I am getting:

Error # = 80040E14
Description = [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
Source = Microsoft OLE DB Provider for ODBC Drivers
SQL State = 37000
NativeError = -3502

----------


## Mark

-----------------
Nate,

Set Mydb.dbDebug=True and try it again.
That will show you the exact SQL that ASP-db was trying to execute.
Copy and paste it into Access and let Access try to run it.
See what happens. Also, let me know on this forum what the SQL
statement looks like from the DEBUG output. It will probably start with:

   &#34;INSERT INTO ...&#34;

Mark.



------------
Nathaniel Tucker at 12/17/99 2:13:25 PM

Here is my code.... It won&#39;t allow me to key in a date into the record.  The actual Access 97 record is set to type &#39;Date/Time&#39;.  If I leave that field blank, it works fine, but errors when there is data entered. Any help would be appreciated:

<%
Set MyDb = Server.CreateObject(&#34;AspDB.Pro&#34 :Wink: 
MyDb.dbmdb=Server.MapPath(&#34;/databases/calendars/calendars.mdb&#34 :Wink: 
MyDb.dbMode=&#34;both&#34;
MyDb.dbUnit=1
MyDb.dbGridInc=20 
MyDb.dbGridDisplayFlds=&#34;Date,Event&#34;
MyDb.dbFormDisplayFlds=&#34;Date,Event,Place,Time,  Contact,Email,Semester,Text&#34;
MyDb.dbNavigation=&#34;bottom&#34;
MyDb.dbStatusBar=False
MyDb.dbNavigationItem=&#34;top,bottom,prev,next,ad  d,update,reload&#34;
MyDb.dbMemoTextSize=&#34;-1&#34;
MyDb.dbEditHideFlds=&#34;KIndex,Category&#34;
MyDb.dbEditUpdateROFlds=&#34;KIndex,Category&#34;
Mydb.dbEditFlds   = &#34;Date,Event,Place,Time,Contact,Email,Catego  ry [Events],Semester,Text&#34;
    EP = &#34;TableName=Q_Update_Event, BookMarkFlds=KIndex, TableTag=Border=0&#34;
    EP = EP & &#34;, size200=1x75, inputsize=5x75&#34;
    EP = EP & &#34;, RecordScope=single&#34;
MyDb.dbEditParams = EP
MyDb.dbGridIndex=&#34;False&#34;
MyDb.dbMagicCell=&#34;Event,,#Event#,index,indexan  chor;&#34;
MyDb.dbSQL=&#34;Select * FROM [Q_Update_Event]&#34;
MyDb.aspDBPro
%>


------------
Nathaniel Tucker at 12/9/99 8:52:49 AM

I made that change, but still having problems...getting the same error.

Thanks,

nate


------------
Frank at 12/8/99 11:37:37 PM

Just taking a quick look at your problem. &#34;Index&#34; is a reserved word and that should be enough to mess you up. Change that firld name to something else first and if still have problem, turn on the debug and look at theEdit SQL statement.


Fk



------------
Nathaniel Tucker at 12/8/99 5:01:23 PM

I am having problems adding & updating records with dates and times.  My code is as follows:

Set MyDb = Server.CreateObject(&#34;AspDB.Pro&#34 :Wink: 
MyDb.dbmdb=Server.MapPath(&#34;/databases/calendars/calendars.mdb&#34 :Wink: 
MyDb.dbMode=&#34;both&#34;
MyDb.dbUnit=1
MyDb.dbGridInc=20 
MyDb.dbGridDisplayFlds=&#34;Date,Event&#34;
MyDb.dbFormDisplayFlds=&#34;Date,Event,Place,Time,  Contact,Email,Semester,Text&#34;
MyDb.dbNavigation=&#34;bottom&#34;
MyDb.dbStatusBar=False
MyDb.dbNavigationItem=&#34;top,bottom,prev,next,ad  d,update,reload&#34;
MyDb.dbMemoTextSize=&#34;-1&#34;
MyDb.dbEditHideFlds=&#34;Index,Category&#34;
MyDb.dbEditUpdateROFlds=&#34;Index,Category&#34;
Mydb.dbEditFlds   = &#34;Date,Event,Place,Time,Contact,Email,Catego  ry[Events],Semester,Text&#34;
EP = &#34;TableName=Q_Update_Event, BookMarkFlds=Index, TableTag=Border=0&#34;
EP = EP & &#34;, size200=1x75, inputsize=5x75&#34;
EP = EP & &#34;, RecordScope=single&#34;
MyDb.dbEditParams = EP
MyDb.dbGridIndex=&#34;False&#34;
MyDb.dbMagicCell=&#34;Event,,#Event#,index,indexan  chor;&#34;
MyDb.dbSQL=&#34;Select * FROM [Q_Update_Event]&#34;
MyDb.aspDBPro
-------------------------
This is the error that I am getting:

Error # = 80040E14
Description = [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
Source = Microsoft OLE DB Provider for ODBC Drivers
SQL State = 37000
NativeError = -3502

----------

