Hello All,

I have a program that displays / edits the company and contact details of our customers.

I have a simple SQL line that retreives all the contacts at a specific company when that company is selected.

Code:
ADOContacts.RecordSource = "Select [SURNAME], [FIRST NAME], [COMPANY], [CONTACT ID] FROM Contacts WHERE Contacts.COMPANY='" & LblCompanyName.Caption & "' ORDER BY [SURNAME]"
I have now found a limitation I didn't think about where we have a customer with an apostrophe in it's name. EG. Mary's Company.

So when the SQL query gets sent with this customer selected I receive an error because of the extra apostrophe.

Code:
"Select [SURNAME], [FIRST NAME], [COMPANY], [CONTACT ID] FROM Contacts WHERE Contacts.COMPANY='Mary's Company' ORDER BY [SURNAME]"
It thinks the company name is 'MARY' and wonders why the s Company' is there.

Is there a way to avoid this error or do i just need to not allow aphostrophes in the Company Name field?

Thanks for your help,

Cheers,

Hojo.