[Last Call] Learn how to a build a cloud-first strategyRegister Now


filter with OR

Posted on 2011-04-26
Medium Priority
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?
Question by:Shawn
LVL 120

Accepted Solution

Rey Obrero (Capricorn1) earned 2000 total points
ID: 35471930
try this

Me.sbfrmEntitySearchSupplier.Form.Filter = "[SupplierCode] LIKE '*" & Me.search0 & "*' OR [SupplierName] LIKE '*" & Me.search0 & "*'"
Me.sbfrmEntitySearchSupplier.Form.FilterOn = True

Open in new window

LVL 75
ID: 35471945
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


Author Comment

ID: 35472603
thanks to both. gr8 solutions/ideas as always

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question