Re: General Question: Single Quotes in Text Fields
- From: Ofer Cohen <OferCohen@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 18 Jun 2007 14:04:01 -0700
Thanks Doug,
You right, now I remember that I'm using this method to pass parameters to a
StoredPrcedure in the SQL server, when single quote involved.
--
Good Luck
BS"D
"Douglas J. Steele" wrote:
Your approach eliminates the apostrophes, Ofer. That's not necessary: you.
can simply double them up:
Replace([FieldName],"'","''")
Exagerated for clarity, that's
Replace([FieldName]," ' " ," ' ' " )
Check my May, 2004 "Access Answers" column in Pinnacle Publication's "Smart
Access". You can download the column (and sample database) for free from
http://www.accessmvp.com/djsteele/SmartAccess.html
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Ofer Cohen" <OferCohen@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B95AC7D2-312D-4833-A6E7-9FB842F7AE9A@xxxxxxxxxxxxxxxx
Try
Replace([FieldName],"'","")
--
Good Luck
BS"D
"LarryP" wrote:
From time to time I run into problems while building dynamic "imbedded
SQL"
strings, because some of the text I'm grabbing from a table or form has
an
apostrophe (AKA single quote) in it. The SQL gets all confused by the
extra
quotation mark without a closing partner. Anybody know a workaround for
this
other than breaking the user's fingers if he uses apostrophes? It's be
great
to have some kind of a function that one could wrap around every text
string
to morph apostrophes into some other character or just delete them
altogether. I'll probably try to write one when I get a spare moment,
but if
someone has already done so, hey, plagiarism's a virtue when you're
writing
code!
- References:
- Re: General Question: Single Quotes in Text Fields
- From: Douglas J. Steele
- Re: General Question: Single Quotes in Text Fields
- Prev by Date: Re: Functions and Recordsets
- Next by Date: Re: Centralised database and distributed databases
- Previous by thread: Re: General Question: Single Quotes in Text Fields
- Next by thread: RE: Passing Parameters
- Index(es):
Relevant Pages
|