Connecting Tech Pros Worldwide Forums | Help | Site Map

Escape charcter for '

Karen Hill
Guest
 
Posts: n/a
#1: Apr 16 '06
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
Guest
 
Posts: n/a
#2: Apr 16 '06

re: Escape charcter for '


Karen Hill wrote in message
<1145213892.214941.22700@e56g2000cwe.googlegroups. com> :[color=blue]
> 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[/color]

Double it up.

....set mymemo = '" & replace(me!txtMyMemo.value, "'", "''") & "' ...

--
Roy-Vidar


David W. Fenton
Guest
 
Posts: n/a
#3: Apr 16 '06

re: Escape charcter for '


"Karen Hill" <karen_hill22@yahoo.com> wrote in
news:1145213892.214941.22700@e56g2000cwe.googlegro ups.com:
[color=blue]
> 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?[/color]

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(###).

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Closed Thread