Solved

RunSQL and Apostoph problem

Posted on 2002-05-26
2
251 Views
Last Modified: 2012-05-04
Hi,

I have a RunSQL statement in my code like this:

DoCmd.RunSQL "INSERT INTO MyTable SET MyField='" & MyValue & "';"

If MyValue is ...

"It's raining."

Then I get the problem of the extra ' (apostroph) in the string MyValue. Same in WHERE clauses.

What is the solution for this problem?
How can I change the SQL statements?

Thanks ...

BL
0
Comment
Question by:beni_luedi
[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
2 Comments
 
LVL 54

Accepted Solution

by:
nico5038 earned 100 total points
ID: 7036428
Just use the chr(34) to embed the double qoute in the string:

DoCmd.RunSQL "INSERT INTO MyTable SET MyField=" & chr(34) & MyValue & chr(34) & ";"

Nic;o)
0
 

Author Comment

by:beni_luedi
ID: 7036563
Like always ... fast and the exact answer. Thanks a lot.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

707 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