There are a couple of ways to deal with this. You could use [] instead of ' to delimit your string. The easier solution is probably to leave the ALLTRIM(THIS.Value) in your SELECT and use ? to tell VFP it's a parameter. This solution will also work if you're using SQLEXEC() to send your query to a remote data source. Try this:
cMyVar = "ALLTRIM(MyTable.MyField) = ?ALLTRIM(THIS.VALUE)"
>Hello,
>I'm using a variable in the WHERE clause of a SQL Statement. The variable looks like so:
>cMyVar = "ALLTRIM(MyTable.MyField) = '" + ALLTRIM(THIS.VALUE) + "'"
>
>Naturally, if MyTable.MyField contains an apostroph (like "De'Isle"), I get a syntax error :-(
>What do I have to do in this case?
>Thanks in advance for your help!