Link to home
Start Free TrialLog in
Avatar of fanguru1
fanguru1

asked on

"Adodc1.Recordset.Filter =" Help

I am currently filtering a recordset with the following:
----Recordset.Filter = "Customer like '" & cust & "'"
Where cust is my variable from an InputBox.
As long as I input the customers name exactly I get the desired results, however I would like be able to modify this for the filter to only match a portion of what I put in. Such as "boo" would return boots, boom etc..
Thanks,

ASKER CERTIFIED SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fanguru1
fanguru1

ASKER

If I use * or % and put in the complete first name I get the listing I am looking for. But I would like to search on the first few characters.
>I would like to search on the first few characters.
In that case you can avoid Like and use Recordset.Filter = "Left(Customer, 5)=cust"

Replace 5 with the number of leftmost characters you want to filter by.  
... slight correction...

Recordset.Filter = "Left(Customer, 5)='" & cust & "'"
You can use a combination of wildcard and fixed.  Try this, assuming cust is 'boo', then this should give you boots, boom etc..

Recordset.Filter = "Customer like '" & cust & "%'"

Leon