View Full Version : apostrophe in a string used in a query to build a recordset


BigJimSlade
03-13-2002, 04:17 PM
Hey, Big Jim here:

Let's say for example I have a setup where I am using this string

strTest = "Doug's"

as a recordset parameter. This will of course cause an error if the SQL was written as:

Select * From Table Where Name = '" & strTest & "';"

What oh what do I do about that apostrophe in strTest that is messing up my sql?

Thanks in advance,

Big Jim

Pat Hartman
03-13-2002, 04:33 PM
You need to surround strTest with double quotes rather than single. Look for the word QUOTE during the past 5 days using the search feature of the forum. I just posted an answer that tells you how I do it.

BigJimSlade
03-13-2002, 07:19 PM
Pat, thanks for your help!

Big jim