Quotes and apostrophes in WHERE clause

G

Guest

Here's a field that I'm using in a where clause. It contains the inches and foot abreviations

8" PVC SDR-26 ( 15' - 18' deep

Because it contains a quotation mark I get an error

Syntax error (missing operator) in query expression 'tbl_Bid_Items.Customer_Item_Name = "8" PVC SDR-26 ( 15' - 18' deep)" ORDER BY Job_ID DESC'

Because it contains both a quotation mark and apostrophes, I can't change my delimiter from a quote to an apostrophe

Any ideas?
 
K

Ken Snell

If you're using ACCESS 2000 and up, you can use the Replace function to
double-up the ' characters (two ' characters in a row tell ACCESS that you
mean one literal ' character and not a delimiter):

tbl_Bid_Items.Customer_Item_Name = Replace([FieldNameWithFootAndInches],
"'", "''") ORDER BY Job_ID DESC


--
Ken Snell
<MS ACCESS MVP>

DARAB said:
Here's a field that I'm using in a where clause. It contains the inches and foot abreviations:

8" PVC SDR-26 ( 15' - 18' deep)

Because it contains a quotation mark I get an error:

Syntax error (missing operator) in query expression
'tbl_Bid_Items.Customer_Item_Name = "8" PVC SDR-26 ( 15' - 18' deep)" ORDER
BY Job_ID DESC'.
Because it contains both a quotation mark and apostrophes, I can't change
my delimiter from a quote to an apostrophe.
 

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