[AccessD] Dealing with single quotes and double quotes at the same time

Stuart McLachlan stuart at lexacorp.com.pg
Wed Nov 1 15:58:52 CST 2006


On 1 Nov 2006 at 14:36, Joe Rojas wrote:

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

Escape both quotes by doubling them.  Following example has extra spaces to 
show it more clearly, there shouldn't be any spaces between any of the 
quotes.:

strSQL = " Set myfield = ' 1 '  '  5 " "  '   "



-- 
Stuart





More information about the AccessD mailing list