Replace special character '=' in a sql string

J

Julia B

Hi, I've got a problem with an ADO recordset which I believe is caused by a
special character in my sql string.

My sql string is as follows:

SELECT RecordID FROM PartNumbers WHERE PNRecd = '987-4829-001=LA' AND
(Status = 'New' OR Status = 'Amended')

This works fine (displaying 1 record) if I create a new query in Access but
returns an empty recordset when run through code using ADO.

I'm assuming the engine doesn't like the '=' character, because it works
with all other records that don't contain this character. I'm wondering if
anyone knows what I can replace this with? I've searched hi and low and can't
find it's character value.

Thanks in advance.

Julia
 
J

Julia B

Thanks Allen, all my other records have dashes in them and they work fine so
I don't think it's that, I think it's the = symbol.

Julia
 
A

Allen Browne

Does it work if you place square brackets around the =, and use the Like
operator:
WHERE PNRecd Like '987-4829-001[=]LA'
 

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