Where clause in DoCmd.Open form issue

  • Thread starter Thread starter Gerry Pyle
  • Start date Start date
G

Gerry Pyle

I understand that string criteria in the Where clause has to be delineated
with ' (an apostrophe).

DoCmd.OpenForm "frmMaster1", acFormDS, , "master1.LAST like '" & SearchParam
& "#'", acFormReadOnly, acWindowNormal

However, if I am trying to find the last name "O'Grady", the ' in the
criteria breaks the operation. The apostrophe in the SearchParam string
messes up the rest of the OpenForm command.

Is there a workaround for this?
 
Rather than using '" and '" (that's ' " and " ' respectively), use three
double quotes in a row. (""")
 
Back
Top