Replace special character '=' in a sql string

  • Thread starter Thread starter Julia B
  • Start date Start date
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
 
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
 
Does it work if you place square brackets around the =, and use the Like
operator:
WHERE PNRecd Like '987-4829-001[=]LA'
 
Back
Top