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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple single quotes problem----Very Urgent !!

Status
Not open for further replies.

vikaskalra

Technical User
Aug 12, 2002
41
GB
Greetings !


Folks I need your expert help on the following case :

I have a recordset, on which I have to filter on multiple fields, in the following manner :

rs.filter ="Description = 'BPD LUCKNOW(260)' and TERRITORYNAME='MUNGR,BNORE,I(602)'"

I don't get any problem when there is a Single Quote in the Field Value, as I have a replace done on the value, which replaces all the single quotes with a two single quotes so the following works fine:

rs.filter="Description = 'BPD LUCKNOW(260)' and TERRITORYNAME='MUNGR,B''NORE,I(602)'"

but the following does not work and raises an error :-

rs.filter="Description = 'BPD LUCKNOW(260)' and TERRITORYNAME='M''UNGR,B''NORE,I(602)'"

Please let me know if there is any way you folks can suggest any solution to this problem.

Regards,
Vikas
 
Hi, the easiest way is to replace your field value quote with another character you'll never found....

by exemple :

cFilter = REPLACE("MUNGR,B''NORE,I(602)","'","¤")

rs.filter="Description = 'BPD LUCKNOW(260)' and REPLACE(TERRITORYNAME,'''','¤') =" & cFilter

And it will works in any case as quotes...
 
Hi
No need to specify a single quote in the filter.
Just specify a double quote(""-twice) , it will work fine.
ie
rs.filter="Description = ""BPD LUCKNOW(260)"" and TERRITORYNAME=""M'UNGR,B'NORE,I(602)"""

Balajee
 
Thanks folks,

I will try and let you know abt. it,

Thanks a lot for all the help,

Regards,
Vikas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top