Insert into syntax error

  • Thread starter Thread starter John Keith
  • Start date Start date
J

John Keith

"INSERT INTO [Staff_CNP-Assignments] FIELDS(SSN, EffectiveDate, AssignedLoc,
PostDate) VALUES('111223333', #2/18/2009#, '020', #2/18/2009#)"

With that as my string value in a DoCmd.RunSQL sSQL what is the syntax error?

Staff_CNP-Assignments table has its primary key as an autonum field and not
referenced in the FIELDS( ) or VALUES( ). With the following 4 fields~data
types: SSN~text, EffectiveDate~date/time, AssignedLoc~text,
PostDate~date/time)

I have double checked the spelling of the field names.
 
John said:
"INSERT INTO [Staff_CNP-Assignments] FIELDS(SSN, EffectiveDate, AssignedLoc,
PostDate) VALUES('111223333', #2/18/2009#, '020', #2/18/2009#)"

With that as my string value in a DoCmd.RunSQL sSQL what is the syntax error?

Staff_CNP-Assignments table has its primary key as an autonum field and not
referenced in the FIELDS( ) or VALUES( ). With the following 4 fields~data
types: SSN~text, EffectiveDate~date/time, AssignedLoc~text,
PostDate~date/time)

I have double checked the spelling of the field names.


Remove FIELDS
 
TaDa!

Key word "FIELDS" is invalid when using Access SQL.

Here is the correct SQL string for Access:
"INSERT INTO [Staff_CNP-Assignments] (SSN, EffectiveDate, AssignedLoc,
PostDate) VALUES('111223333', #2/18/2009#, '020', #2/18/2009#)"
 
Back
Top