Where clause in DoCmd.Open form issue

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?
 
D

Douglas J. Steele

Rather than using '" and '" (that's ' " and " ' respectively), use three
double quotes in a row. (""")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top