Problem with a RunSQL Statement in MS Access

I am really scratching my head with a SQL Statement I am trying to run in VBA in MS Access 2010.

I have an Access 2010 app connected to SQL Server 2008 R2 at the back end.

DoCmd.RunSQL "INSERT INTO [Cases] ( TargetResponseDate, ResolutionTargetDate, ClientID, CreatedBy, AssignedTo, DateCreated, EnquiryTypeID, CaseTypeID, SubTypeID, PolicyTypeID, PolicySubTypeID, GovDeptID, MinisterID, Note) SELECT '" & strTargetResponse & "', '" & strTargetResolution & "', " & intClientID & ", " & intUserID & ", " & intUserID & ", '" & strDateCreated & "', " & intEnquiryTypeID & ", " & intCaseTypeID & ", " & intSubTypeID & ", " & intPolicyTypeID & ", " & intPolicySubTypeID & ", " & intGovtDeptID & ", " & intMinisterID & ", '" & strCaseSummary & "'"

Open in new window


Am including code twice so it can be seen outside the code insert

DoCmd.RunSQL "INSERT INTO [Cases] ( TargetResponseDate, ResolutionTargetDate, ClientID, CreatedBy, AssignedTo, DateCreated, EnquiryTypeID, CaseTypeID, SubTypeID, PolicyTypeID, PolicySubTypeID, GovDeptID, MinisterID, Note) SELECT '" & strTargetResponse & "', '" & strTargetResolution & "', " & intClientID & ", " & intUserID & ", " & intUserID & ", '" & strDateCreated & "', " & intEnquiryTypeID & ", " & intCaseTypeID & ", " & intSubTypeID & ", " & intPolicyTypeID & ", " & intPolicySubTypeID & ", " & intGovtDeptID & ", " & intMinisterID & ", '" & strCaseSummary & "'"

This statement works fine except for the last field before the SELECT i.e. Note. This field exists and is fine I can enter data into it on the front end. However, when I run the SQL statement I get

Error 3134
Syntax error in INSERT INTO Statement

If I change the field Name to that of a different Memo field in the database i.e. NotePublic which is an identical field.  There is no problem and the statement runs. So there is nothing wrong with the statement construct. I wondered if Note was some sort of reserved name. But have checked SQL Server notes and can't see that it is.

I wonder if anyone could shed some light. To change the field name would be a big deal, so I really don't want to go there.

Many thanks
martmacAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

martmacAuthor Commented:
I should add that even if I run this

"INSERT INTO [Cases] (Note) SELECT 'Test'"

i.e. just updating the one field I still get the same error message. So it doesn't seem to like "Note" wonder if it's reading Not??
0
mbizupCommented:
Place note in square brackets

 [ Note]
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
martmacAuthor Commented:
All that head scratching and so simple, but only if you know the answer. Thanks so much, very much appreciated. I can relax now!
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

martmacAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for martmac's comment #a39517135

for the following reason:

Just the ticket
0
mbizupCommented:
Glad to help out :-)

I'm posting using the 'object' button to cancel this close request because I think you accidentally selected your own comment as the answer (see the automated post above this one).  


Try closing the question again...
0
martmacAuthor Commented:
Really really sorry, been up all night working on the project.

Thanks again
0
mbizupCommented:
No worries -

Thank you :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.