Opening client form with apostrophe in name

  • Thread starter Thread starter pkeegs
  • Start date Start date
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
 
Use double quotes (2 double quotes together equals ONE quote in the string)

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

Mark
 
Back
Top