Re: General Question: Single Quotes in Text Fields



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!



.



Relevant Pages

  • Re: handling apostrophe
    ... replace each single quote with two ... single quotes before submitting it to SQL server. ... use command and parameter objects ... > How can i feed it in the routine if i am only a user of that routine.. ...
    (microsoft.public.sqlserver.programming)
  • Provider not found
    ... occur with any ODBC or SQL based database, not just MS SQL Server. ... controls connected to a Sybase database. ... I re-applied the SQL server SP 3 - no luck ... I found these in my i386 folder. ...
    (microsoft.public.sqlserver.odbc)
  • Re: SQL query fails
    ... > that is acceptable to Oracle, SQL Server, and Access. ... > this requires using the single quote as the literal string delimiter as well ... > thise case determines it to be the single quote. ...
    (microsoft.public.access.queries)
  • Re: bound forms
    ... If you're using a pass-through query to SQL Server, ... As to editing between a control and the table to which it's bound, ... > string between a control and the table it is bound to, the single quote ... >>> Is there any straightforward way of getting between a bound textbox and ...
    (microsoft.public.access.forms)
  • Re: KDE and US International keyboard
    ... > special characters that English keyboards don't produce easily. ... which supposedly should insert a single quote. ... Any luck anyone? ...
    (freebsd-questions)