Insert into syntax error

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.
 
M

Marshall Barton

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
 
J

John Keith

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#)"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top