how to work around DataEnvironment Filter that includes an apostrophe?

  • Thread starter Thread starter Mike Scirocco
  • Start date Start date
M

Mike Scirocco

I'm using a DataEnvironment and trying to use a filter that includes an
apostrophe, e.g. if

cmbCustomer.text = "Dan's Auto Body Repair"

then this line generates an error:

DE.rsCommand2.Filter = "CustName='" & cmbCustomer.Text & "'"

Is there a workaround that will allow me to keep the apostrophes in the
database entries?

TIA,
Mike
 
Mike said:
I'm using a DataEnvironment and trying to use a filter that includes an
apostrophe, e.g. if

cmbCustomer.text = "Dan's Auto Body Repair"

then this line generates an error:

DE.rsCommand2.Filter = "CustName='" & cmbCustomer.Text & "'"

Is there a workaround that will allow me to keep the apostrophes in the
database entries?

TIA,
Mike

Found it in another newsgroup:

SELECT * FROM 'cars.sold' where seller='" &
Replace(txtSellername.text,"'","''") & "'"

Mike
 
Back
Top