[AccessD] Building SQL statement

John W. Colby jwcolby at colbyconsulting.com
Wed Aug 24 22:43:23 CDT 2005


So I have to search the input string looking for all single quote '
characters and replace it with two single quote characters ''?  I was afraid
of that.

John W. Colby
www.ColbyConsulting.com 

Contribute your unused CPU cycles to a good cause:
http://folding.stanford.edu/

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: Wednesday, August 24, 2005 11:30 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Building SQL statement


On 24 Aug 2005 at 23:23, John W. Colby wrote:

> 
> The problem is that description can contain the ' character and thus I 
> end up with an invalid SQL statement since the ' embedded in 
> description "looks like" the ' that is supposed to enclose the text.
> 
> I can't for the life of me remember how I am supposed to handle this.
> 

Description = Replace(Description,"'","''")

That's a single quote between double quotes as the second parameter and two 
single quotes between double quotes as the third parameter.

Double up the single quote "escapes" it in the input string

-- 
Stuart


-- 
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