Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

RunSQL and Apostoph problem

Posted on 2002-05-26
2
Medium Priority
?
257 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 400 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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 earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
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 …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

618 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