p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   VB Databases Basics (http://p2p.wrox.com/forumdisplay.php?f=82)
-   -   using apostrophe in Access string fields (http://p2p.wrox.com/showthread.php?t=31082)

badgolfer July 1st, 2005 09:04 AM

using apostrophe in Access string fields
 
hi,
     I am using some simple string fields in a simple Access
database table. Sometimes I have apostrophes in the text data eg
in a name field I may have John O'Hara. If I build my insert
query this apostrophe causes me a problem eg
 "insert into mytable (name) values ('John O'Hara')"

the apostrophe in the O'Hara signals the end of the string and
my sql code fails. How can I overcome this ? Is there a way that
I can keep the original text in the data or do I have to substitute
the apostrophe character for something else like "`" ?

Cheers muchly.



lam_lvl July 15th, 2005 12:47 AM

You have must replace that string before run query insert.
For example: value ="Lam's"
value=replace(value,"'","""")
then make query and run it !. Right !?



L.V.L


All times are GMT -4. The time now is 07:35 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.