Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help - I'm lost in the quotes...

Status
Not open for further replies.

sunaj

Technical User
Feb 13, 2001
1,474
DK
Hi,

VB6.0, ADO2.5, winNT

I'm looking for strings in my tables by using the .find method on a recordset:

------------------------------------------------------------
tmp = "IFREMER Station de la Rochelle-L'Houmeau,17137"
Rst.Find "name='" & Replace(tmp, "'", "''") & "'"
------------------------------------------------------------

Here there is 1 single quote (') and the replace statement replaces this with 2 single quotes (''). This works fine. BUT:
------------------------------------------------------------
tmp = "IFREMER Station de la Rochelle-L'Houmeau,17137,L'Houmeau"
Rst.Find "name='" & Replace(tmp, "'", "''") & "'"
------------------------------------------------------------

Here there is 2 single quotes in the string (tmp). And the .find method raises and error: 3001, Agruments are of the wrong type, ... bla bla

What am I doing wrong here?
Sunaj
 
Try:

tmp = "IFREMER Station de la Rochelle-L'Houmeau,17137,L'Houmeau"
Rst.Find "name=" & Chr(34) & tmp & Chr(34)

Chr(34) is "

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top