[AccessD] SQL statement problem

Stuart McLachlan stuart at lexacorp.com.pg
Thu May 8 18:01:44 CDT 2003


On a couple of occasions where I've run into this, I've replaced the 
Chr$(39) with a Chr$(96) which doesn`t look to dissimilar (that's 
what's in the previous "doesn`t") and is very rarely used.

I Replace() it back wherever I can before displaying the data, but if 
it sneaks through raw into a query or report it remains quite 
readable.

I normally use a couple of simple functions:

Function SafeQuote(data as string) as string
	SafeQuote = Replace(data,Chr$(39),Chr$(96) 
End Function

Function RealQuote(data as string) as string
	RealQuote = Replace(data,Chr$(96),Chr$(39) 
End Function

In this case it becomes
"Insert into...... SafeQuote(ErrDescription)....."


On 8 May 2003 at 17:51, Arthur Fuller wrote:

> 
> ? Replace("The form name 'This Form' is misspelled or refers to a form
> that doesn't exist.", Chr(39), Chr(34)) The form name "This Form" is
> misspelled or refers to a form that doesn"t exist.
> 
> Note the double quote in doesn't.
> 
> I was playing around with variations on the above Replace() when
> suddenly it occurred to me that there's a much slicker way:
> 
> ? Replace("The form name 'This Form' is misspelled or refers to a form
> that doesn't exist.", "doesn't", "does not") The form name 'This Form'
> is misspelled or refers to a form that does not exist.
> 
> Admittedly it's limited to this particular error message and would
> fail on strings such as "The form name 'This Form' was created by
> Michael O'Hara and Patty O'Furniture."
> 
> Too bad Access doesn't do regex.
> 

-- 
Lexacorp Ltd
http://www.lexacorp.com.pg
Information Technology Consultancy, Software Development,System 
Support.





More information about the AccessD mailing list