Quotes and apostrophes in WHERE clause

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
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.
 
Back
Top