When a user types ' in a Memo control, It throws an error message on a
DoCmd.RunSQL. What is the escape character for ' which I can insert
before ' so it won't throw an error message? Any other ideas on
dealing with this?
Thanks
RoyVidar - 16 Apr 2006 20:08 GMT
Karen Hill wrote in message
<1145213892.214941.22700@e56g2000cwe.googlegroups.com> :
> When a user types ' in a Memo control, It throws an error message on
> a DoCmd.RunSQL. What is the escape character for ' which I can
> insert before ' so it won't throw an error message? Any other ideas
> on dealing with this?
>
> Thanks
Double it up.
...set mymemo = '" & replace(me!txtMyMemo.value, "'", "''") & "' ...

Signature
Roy-Vidar
David W. Fenton - 16 Apr 2006 20:33 GMT
> When a user types ' in a Memo control, It throws an error message
> on a DoCmd.RunSQL. What is the escape character for ' which I can
> insert before ' so it won't throw an error message? Any other
> ideas on dealing with this?
If you put double quotes around the string values in your SQL, it
should run without an error.
If you have mixed ' and " in the field, then use " around the
literal value and parse the " in the field to Chr(34).
You can find the ASCII code with Asc("'"), and refer to it as
Chr(###).

Signature
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/