[AccessD] Dealing with single quotes and double quotes at thesametime

Joe Rojas JRojas at tnco-inc.com
Wed Nov 1 14:12:20 CST 2006


Thanks for the reply John,

If I were to construct a string using your example:
strText = "1" & chr$(39) & " 5" & chr$(34)

and then executed a statement of :
DoCmd.RunSQL "Update someTable SET fieldname = '" & strText & "' WHERE
someField = someValue"

Won't this generate an error because the DoCmd.RunSQL will get confused
with the mixture of quotes and double quotes?

Thanks,
Joe Rojas
IT Manager
TNCO, Inc.
781-447-6661 x7506
jrojas at tnco-inc.com


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Skolits
Sent: Wednesday, November 01, 2006 3:05 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Dealing with single quotes and double quotes at
thesametime

Here's an example

strText = "1" & chr$(39) & " 5" & chr$(34)

In this case strText would return - 1' 5"

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Joe Rojas
Sent: Wednesday, November 01, 2006 2:37 PM
To: Access Developers discussion and problem solving
Subject: [AccessD] Dealing with single quotes and double quotes at the
sametime

Hello,

If I construct a string in VBA that contains the following string:
1' 5"

How could I update a field using DoCmd.RunSQL?
I know how to handle this if the string only contains a single quote OR
a double quote but not if the string contains both.

Thanks,
Joe Rojas
IT Manager
TNCO, Inc.
781-447-6661 x7506
jrojas at tnco-inc.com
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list