Solved

' and Access

Posted on 2002-07-17
8
158 Views
Last Modified: 2012-05-04
When I take a string from a text box.. and that string has a ' in it.. it won't store into the DB and throw me an error!

What can I do with this?
0
Comment
Question by:nfuids
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 25 total points
ID: 7160835
Use:
sText = Replace(sText, "'", "''")

Anthony
0
 

Expert Comment

by:kuist
ID: 7160930
'' will be accepted by Access as a ' ?

like if I enter somethink like:


what's your best ...


when I would retreive it from ACCESS and put it in a label's caption, it would be " what's your best ... " ?

0
 

Author Comment

by:nfuids
ID: 7165868
hello?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:nfuids
ID: 7165873
yeah, kuist is right, I don't think making ' -> '' would do the job!
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7166022
>>yeah, kuist is right, I don't think making ' -> '' would do the job! << Then I wish you the best of luck.

Also, please maintain your open questions:
PHP + mcrypt w/ IIS Date: 05/27/2002 12:40PM PST
http://www.experts-exchange.com/webhosting/Q_20305118.html
(This last can be deleted as there are no contributions)
Stats + IIS Date: 05/27/2002 12:49PM PST  
http://www.experts-exchange.com/webhosting/Q_20305122.html
mcrypt Date: 05/22/2002 12:14PM PST
http://www.experts-exchange.com/php/Q_20303646.html
swf (flash) + php Date: 06/30/2002 11:20PM PST
http://www.experts-exchange.com/php/Q_20318115.html
HTTP Authentification Date: 07/02/2002 08:00PM PST  
http://www.experts-exchange.com/php/Q_20318931.html

Thanks,
Anthony

0
 
LVL 4

Expert Comment

by:Nazdor
ID: 7187907
Replace single quote with two single quotes

0
 
LVL 4

Expert Comment

by:Nazdor
ID: 7187920
Replace single quote with two single quotes

   '  ->  ''

Note that's not a double-quote (as in speech marks), it's an apostrophe, ascii characer 39.  This isn't overly clear in any of the posts above.

When SAVING data (as the original question asks), that is what you do (always replace all single-quotes with two-single-quotes).

This will be stored in the Database as a single quote.

When you next READ the data, it will have a single quote as expected.





0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7193550
Nazdor,

Thanks,
Anthony
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question