alevin16
asked on
How do I read a field with an & in it for SQL
Hello Everyone,
I have an access 2010 program that I am converting to work with the backend on the cloud. On one form I have a listbox that when the user clicks on a line the system needs to find the record based on a client ID and client name. Sadly some of the client names have & in them. I am getting a parsing error because of the &.
Short of changing the & to and for all the clients is there a way using VBA to have it see the & as an &?
Thanks
I have an access 2010 program that I am converting to work with the backend on the cloud. On one form I have a listbox that when the user clicks on a line the system needs to find the record based on a client ID and client name. Sadly some of the client names have & in them. I am getting a parsing error because of the &.
Short of changing the & to and for all the clients is there a way using VBA to have it see the & as an &?
Thanks
Try putting the field name in quotes.
If you mean you are using SQL strings to query your backend try...
SELECT * from tblCompanies WHERE tnlCompanies.CompanyName like 'Benson \& Sons';
You need to replace all & with \& before your selects.
SELECT * from tblCompanies WHERE tnlCompanies.CompanyName like 'Benson \& Sons';
You need to replace all & with \& before your selects.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hello everyone,
I found my error. It was actually not a & but a / in the name. In my program those are easy to remove and keep the people from putting them in again.
Thank you all!
I found my error. It was actually not a & but a / in the name. In my program those are easy to remove and keep the people from putting them in again.
Thank you all!
ASKER
I asked the wrong question actually