double quotes in the SQL string

S

Souris

I use DAO.QueryDef and pass parameter to update or insert in to my table.

The query failed if user enter double quote in the text which Access thinks
it is invalid SQL statement.

Are ther any way to workaround to let user enter double quotes in the text?


Your information is great apreciated,
 
J

J_Goddard via AccessMonster.com

If the user enters the text in a form, try replacing all the double-quotes
with double double-quotes (!) after the user enters the string (use the After
Update event of the textbox):

MyString = replace(me!txtstring, chr(34), chr(34) & chr(34) )

and then use MyString in the QueryDef.

John
 

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