Opening client form with apostrophe in name

P

pkeegs

I have been trying to make sense of previous responses to similar questions
without success - so my problem! I have a client form from which I open
another form with additional information on a client. When I have a client
with an apostrophe in the name (O'Neill) I get the message
---------------------------
Syntax error (missing operator) in query expression '[Full Name]='John
O'Neill''.

The system generated code is

stDocName = "Additional Details"

stLinkCriteria = "[Full Name]=" & "'" & Me![ParameterFullName] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

What changes do I need to make the code work? - Regards
 
M

Mark Andrews

Use double quotes (2 double quotes together equals ONE quote in the string)

stLinkCriteria = "[Full Name]=""" & Me![ParameterFullName] & """"

Mark
 

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