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
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
On Friday, December 18, 2020 at 10:22:25 AM UTC-6, musicloverlch wrote:--- Synchronet 3.21b-Linux NewsLink 1.2
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,Replace will work for the 1 character, but others can cause problems.
Laura
if the text is no more then 255 characters use a parameter query, which will allow any text.
Dim updateBody As DAO.QueryDef
Set updateBody = CurrentDb.CreateQueryDef(vbNullString, "PARAMETERS [newBody] Text ( 255 ); UPDATE tblEmailings SET tblEmailings.Body = [newBody];")
updateBody.Parameters(0) = "This is an 'example' of the text." updateBody.Execute
Set updateBody = Nothing
If it is a memo, a recordset may work.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 65 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 08:02:48 |
| Calls: | 862 |
| Files: | 1,311 |
| D/L today: |
1 files (1,366K bytes) |
| Messages: | 264,936 |