Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"INSERT INTO" missing operator problem

Status
Not open for further replies.

joxo1

Programmer
Aug 5, 2004
25
0
0
GB
Hi,

I have an application that has a "Notes" textbox where I want the user to be able to type anything they want.

The problem is that whenj I try to do an 'INSERT INTO' command I somtimes get the error "Syntax error (missing operator) in query expresion ....."

It only seems to happen when the user types special characters such as &^*(&*"$%"£$ etc...

I can't identify which one is causing the error and anyway I want the user to be allowed to type anything that the textbox will allow..

Can anyone help??

Cheers
 
Do you have some code that you would like to share? I expect the user has typed in a single or double quote.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Is there a reason you don't have the form do the inserts directly into the table? Can you bind the textbox to a field in another table and then use an append query to add the "temp" record to your main table? Are you even using an Access form?

John
 
Something like this ?
DoCmd.RunSQL "INSERT INTO yourTableName ([yourNotesField]) VALUES ('" _
& Replace([yourNotesTextbox], "'", "''") & "');"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top