Re: Search for Record



"Tom van Stiphout" <no.spam.tom7744@xxxxxxx> replied in message
news:t8aqq3pgl0igmk5skbl1n0bene1evjiig7@xxxxxxxxxx

I prefer to double up on the single-quotes:
Me.Filter = "[LastName] = '" & Replace(Me.txtLastName,"'", "''") & "'"

Tom, the difficulty I have with doubling the single (or double) quotes arises when you have functions that call other functions to build the strings. That's pretty common, but I don't know how to determine at what level the replace needs to be done.

It might sound corny, but what I generally do is to disallow the double-quote character in data (and document it.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

.



Relevant Pages

  • Re: VBA output to text editor
    ... You specify your position in the ... <filenumber> is the number of the open file. ... If you had 3 strings that made up an ... back correctly because the strings will have double quotes around it. ...
    (microsoft.public.excel.programming)
  • [opensuse] Re: apache mod_rewrite
    ... outside of quotes and inside double-quote strings but not inside ... single-quote strings. ... based on the intention of it being included in that command, ... If you want to insist that my read of this is incorrect, ...
    (SuSE)
  • Re: Cant pass "[System.IO.FileMode]::Open" as a Constructor argument of "FileStream"
    ... you need to use quotes if the argument is going to contain any ... > doesn't this make it very hard to resolve to the correct member overload? ... Agreed - expression mode let's you be very explicit. ... >> these argument strings and converts them into the necessary target ...
    (microsoft.public.windows.server.scripting)
  • Re: New Strings or Old; Any Preference?
    ... THEY'RE TALKIN' ABOUT CHANGIN' STRINGS, ... Tom from Texas ... a perfect chord on fret 3 will be imperfect on higher frets. ...
    (rec.music.makers.guitar.acoustic)
  • Re: the greatest Beatle
    ... >The pot is calling the kettle black. ... Tom, I'm not the one who's posting wholly out-of-context quotes as well ... >Tony Bramwell, who knows Paul, says Paul believes it (which would ...
    (rec.music.beatles)