Single quote

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I use a list box information to insert user's comments.

I have following SQL statement:

"INSERT INTO MYTABLE
SET COMMENTS = ME!MYLISTBOX
WHERE ACCOUNT_NUMBER = ME!ACCOUNT_NUMBER"

It fails if user uses a single quote, since the SQL server assumes it is the
end of SQL statement.

Will it work if user uses double quote?
Any information is great appreicated,
 
"INSERT INTO MYTABLE
SET COMMENTS = '" & Replace(ME!MYLISTBOX, "'", "''") &
"' WHERE ACCOUNT_NUMBER = " & ME!ACCOUNT_NUMBER

Exagerated for clarity, the second line is

SET COMMENTS = ' " & Replace(ME!MYLISTBOX, " ' ", " ' ' ") &

and the third line starts:

" ' WHERE ...
 

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

Back
Top