Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 1st, 2005, 09:04 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.


 
Old July 15th, 2005, 12:47 AM
Authorized User
 
Join Date: Aug 2003
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
DIRECT ACCESS TO DATASET FIELDS kostaskon Pro VB Databases 0 February 27th, 2008 12:54 PM
Create one string from multiple fields paul20091968 Access VBA 17 August 3rd, 2007 09:52 AM
How to access Simply Accounting fields from Access lguzman Access VBA 4 September 16th, 2004 02:55 PM
Access long text fields Tharkun SQL Server ASP 2 October 30th, 2003 08:47 AM
Using a datagrid with Access D/B Time fields rosenzl VS.NET 2002/2003 1 June 22nd, 2003 04:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.