How to preserve single quotes in a runsql update statement

Giganews Newsgroups
Subject: How to preserve single quotes in a runsql update statement
Posted by:  musicloverlch (lhow…@gmail.com)
Date: Fri, 18 Dec 2020

I have a line in an email text that has single quotes in it like this:

EmailText = "This is an 'example' of the text."

Then when I run this:

DoCmd.RunSQL "UPDATE tblEmailings SET tblEmailings.Body = " & EmailText & ";"

It errors out and I'm sure it's because of the single quotes in the EmailText.

How do I get around this?  A web search has proved to be unhelpful.

Thanks,
Laura

Replies