Solved

' and Access

Posted on 2002-07-17
8
157 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
  • 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
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.

 

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

840 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