Re: SQL SELECt with ' in filter name



Hi Khalid,

Try this

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

--
Víctor Koch.


"Khalid Rahaman" <KhalidRahaman@xxxxxxxxxxxxxxxxxxxxxxxxx> escribió en el
mensaje news:972A1E89-6FCB-47AA-921B-3BB6977EB8B0@xxxxxxxxxxxxxxxx
I am trying to filter a recordset using the following SQL statement

SELECT * FROM 'cars.sold' where seller='" & txtSellername.text & "'"

the txtsellername.text refers to a texbox on the VB form which enters the
name i want to filter by.

This works great for everything except when the variable contains an ' in
the textbox for example "Joe's Auto".

Any help would be appreciated.

Thanks


.



Relevant Pages

  • Re: SQL SELECt with in filter name
    ... the txtsellername.text refers to a texbox on the VB form which enters ... the name i want to filter by. ... Please reply to the newsgroup. ...
    (microsoft.public.data.ado)
  • Re: SQL SELECt with in filter name
    ... the txtsellername.text refers to a texbox on the VB form which enters the ... name i want to filter by. ... Stephen Howe ...
    (microsoft.public.data.ado)
  • Re: Capture source filter wrapper
    ... I find it hard to believe WMP is asking for this IID, ... it refers to IDirectVobSub: ... the filter graph"... ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: Filtering records using SQL statement with in field name
    ... You need to double up the single quote mark. ... the txtsellername.text refers to a texbox on the VB form which enters the ... Al Reid ...
    (microsoft.public.vb.database)