Board index » delphi » Filtering for a partial string in a field via Ado, DBase

Filtering for a partial string in a field via Ado, DBase

I am using ADO and DBASE to create a filter for a partial string in a field.
I have tried
Tbl.Filter :=  'Address1= $'''''+strCheckFor+''''';
Tbl.Filter :=  'Address1= $'''''+strCheckFor+'*'''';
Tbl.Filter :=  'Address1 like '''''+strCheckFor+'*'''';
Tbl.Filter :=  'Address1='''+strCheckFor+'*''';

and several other variations, none of which work

How do I filter a string using a Dbase filter?

 

Re:Filtering for a partial string in a field via Ado, DBase


Quote
>I am using ADO and DBASE to create a filter for a partial string in a field.
>I have tried
>Tbl.Filter :=  'Address1= $'''''+strCheckFor+''''';
>Tbl.Filter :=  'Address1= $'''''+strCheckFor+'*'''';
>Tbl.Filter :=  'Address1 like '''''+strCheckFor+'*'''';
>Tbl.Filter :=  'Address1='''+strCheckFor+'*''';

>and several other variations, none of which work

>How do I filter a string using a Dbase filter?

Dbase and ADO is not a combination I would ever recommend using but you might
try
Tbl.Filter :=  'Address1 Like '+QuotedStr(strCheckFor+'%');

This works on Access so maybe it will work with other JET drivers.
--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads