I have a main form for customer head office details with CustID, CustName,
CustAddress etc which has a subform for invoice addesses. There is also a
command button which will take you to another form which is for delivery
addresses. Now some customers have an apostrophe in their company names but
if I put the apostrophe in the text box containing the company name, say
“Acme’s” for instance, and then click the delivery address command button I
get an error message saying “Syntax error in string in query expression
’[CompanyName]=’Acme’s”. I can put any other puctuation in and it opens the
delivery address form no problem. What am I doing wrong and is there any way
to cure it?
Allen Browne - 31 Jul 2005 12:37 GMT
Use the double-quote instead of the single quote to delimit the value, i.e.:
"[CompanyName=""Acme's"""
The doubled-up double quotes are needed to tell VBA this is an embedded
quote, not the end of the string.

Signature
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.
>I have a main form for customer head office details with CustID, CustName,
> CustAddress etc which has a subform for invoice addesses. There is also a
[quoted text clipped - 10 lines]
> way
> to cure it?