Steve, I never use the single quote character to delimit a string within a
string, because the apostrophe is just too common. (The only exception I
make to that rule is if I have the literal available at design time, so I
know for sure the is no embedded single quote.)
IME, the double-quote character is rare in most databases, the most common
examples being the abbreviation for inches or seconds. If I can get away
with it, I actually block the entry of the double-quote char, by using the
KeyDown event of each form, and documenting it. (I find that's easier than
trying to write generic functions that can be called from other generic
functions where you are not sure whether you have Replace()d your
double-quote with double double-quotes or not.)
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
Steve Schapel said:
Allen said:
Realistically, nothing is as simple to type and as fast to execute as:
"WHERE [City] = """ & Me.txtCity & """ ORDER BY ...
I agree that I can't see any advantage in using such a function. The
habit I have got into is...
"WHERE [City] = '" & Me.txtCity & "' ORDER BY ...
...or, if there is a chance the data might ihnclude an apostrophe...
"WHERE [City] = " & """" & Me.txtCity & """" & " ORDER BY ...
I find both of these easy and no problem. Allen, how do these compare
with the way you did it?