Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 1st, 2005, 09:04 AM
Friend of Wrox
 
Join Date: Sep 2003
Location: Whitstable, , United Kingdom.
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.


Reply With Quote
  #2 (permalink)  
Old July 15th, 2005, 12:47 AM
Authorized User
 
Join Date: Aug 2003
Location: HCM, HCM, Vietnam.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:19 AM.


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