We help IT Professionals succeed at work.

filter with OR

Shawn
Shawn asked
on
Medium Priority
304 Views
Last Modified: 2012-05-11
I have a filter that works fine with one element but when I add a second it doesn't work.

right now I have a search text box in a main form that filters a subform based on the textbox in the subform called "SupplierCode". I also have a textbox called "SupplierName" and would like to apply the filter to both textboxes...filtering anything that contains either part of the "SupplierCode" OR the "SupplierName".

here is the simple filter that works:
Me.sbfrmEntitySearchSupplier.Form.Filter = "[SupplierCode] LIKE '*" & Me.search0 & "*'"
Me.sbfrmEntitySearchSupplier.Form.FilterOn = True

how would I do this?
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
CERTIFIED EXPERT
Top Expert 2007

Commented:
Try this:

Me.sbfrmEntitySearchSupplier.Form.Filter = "[SupplierCode] LIKE *" & Chr(34) & Me.search0 & Chr(34) & "*" & " OR [SupplierName] LIKE *" & Chr(34) & Me.search0 & Chr(34) & "*"
Me.sbfrmEntitySearchSupplier.Form.FilterOn = True


mx

Author

Commented:
thanks to both. gr8 solutions/ideas as always
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.