INSERT statement from form, resulting in Run-time error '3075' Error

irunergoiam

Registered User.
Local time
Yesterday, 19:09
Joined
May 30, 2009
Messages
76
I am trying to create an INSERT statement from a form to put unbound fields in a table. The challenge that I am a getting is that I am getting a

Run-time error '3075' Syntax error in date in query expression '#'

What is really perplexing and perhaps something that may guide in identifying the culprit is that I have an identifcal form that uses the identical code and it works.

If it helps, here is the code below:

Dim strSQL As String
Dim strCriteria As String
strSQL = ""
strSQL = strSQL & " INSERT INTO [tblTicket]"
strSQL = strSQL & " ([UpdatedBy], [AssignedTo], [Requestor], [Dept], [DateRequested], [TimeRequested], [DateTimeOpened], [DateOpened], [TimeOpened], [DateLastAction], [TimeLastAction], [Description])"
strSQL = strSQL & " Values"
strSQL = strSQL & " ('" & unbEnteredBy & "','" & cmbAssignedTo & "','" & cmbRequestor & "','" & cmbDepartment & "',#" & unbDateRequested & "#,#" & unbTimeRequested & "#,#" & unbDateTimeOpened & "#,#" & unbDateOpened & "#,#" & unbTimeOpened & "#,#" & unbLastFollowUpDate & "#,#" & unbLastFollowUpTime & "#,'" & unbDesc & "')"
CurrentDb.Execute strSQL, dbFailOnError
 
Just curious... Is there any specific reason you have the same information stored in 3 separate fields?

[DateTimeOpened], [DateOpened], [TimeOpened]
 
I inherited the database and the three date fields were already in use.
 
It would appear the problem is with one of your date/time fields. I would double check your tables that all the fields you have designated in the SQL statement as dates are of the type Date/Time.
 

Users who are viewing this thread

Back
Top Bottom