Skip to main content
April 25, 2008
Answered

Syntax error in INSERT INTO statement

  • April 25, 2008
  • 1 reply
  • 666 views
Hi, I have several form fields that are supposed to be inserted into an Access database. Several of the values are dates, which I created with dropdown menus that the users choose their values from, and then I used the CreateDate/CreateTime function to format them properly for Access date/time fields. However... I can't seem to get past this error! I have checked to be sure that I am not using any reserve words, and I don't think there are any misplaced commas, etc., although I could have missed something. I am guessing it has something to do with the date fields. I don't have any specific formatting on them in Access. Please help! Thanks :)
This topic has been closed for replies.
Correct answer -__cfSearching__-
semi star gazer wrote
Yes, everything matches up
I do not think so. Do your parenthesis match?

although I am not sure where the "1899-12-30" is coming from on the createTime
Have a look at the Access documentation. It explains the signifigance of 1899-12-30
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnaraccess/html/msdn_datetime.asp

'#Trim(form.datestamp)# #Trim(form.timestamp)#
Unlike the other form values, you are passing in the date and time stamp as a string. Why not use ParseDateTime instead?

1 reply

Inspiring
April 25, 2008
> INSERT INTO events ( eventName, eventDate, eventStartTime, eventEndTime,
> location, contactInfo, details, eventURL, sponsor, runStart, runEnd,
> dateSubmitted ) VALUES ( 'asdf', {ts '2008-01-02 00:00:00'}, {ts '1899-12-30
> 07:05:00'}, {ts '1899-12-30 07:10:00'}, 'asdf', 'asdf', 'sdf', '', '', {ts
> '2008-01-02 00:00:00'}, {ts '2008-01-03 00:00:00'}, '04/24/2008 10:19:57 PM'

Look at the SQL it's trying to execute. Is it syntactically correct?

--
Adam
April 25, 2008
Yes, everything matches up, although I am not sure where the "1899-12-30" is coming from on the createTime functions.
-__cfSearching__-Correct answer
Inspiring
April 25, 2008
semi star gazer wrote
Yes, everything matches up
I do not think so. Do your parenthesis match?

although I am not sure where the "1899-12-30" is coming from on the createTime
Have a look at the Access documentation. It explains the signifigance of 1899-12-30
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnaraccess/html/msdn_datetime.asp

'#Trim(form.datestamp)# #Trim(form.timestamp)#
Unlike the other form values, you are passing in the date and time stamp as a string. Why not use ParseDateTime instead?