Solved

Filtering using "contains"

Posted on 2006-11-09
4
461 Views
Last Modified: 2010-05-18
I have a database table in Access 2003.  I have a column that has data like this:

HC, IC, HP, PO
IC, PO, EM
IC,
EM, PO, WE

What I need to do is filter the table to show all records containing HC or PO or EM

0
Comment
Question by:LiamMcKay
  • 2
  • 2
4 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 17905438
Hi LiamMcKay,

Try using like:

me.filter = "[YourField] LIKE '*HC*' OR [YourField] LIKE '*PO*' Or [YourField] LIKE '*EM*'"

(replace YourField with the application specific name)

0
 
LVL 44

Accepted Solution

by:
Leigh Purvis earned 75 total points
ID: 17905460
If they're all definitely only two characters then that should be all you need.
Often when that isn't the case it's a good idea to include the commas - to make sure you're hitting a string inside another :-)
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17905630
lol - umm I think you missed?
I was just passing the time of day - stood here leaning on the metaphorical lamppost.

Miriam's Q surely.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 17905688
*Lol!*
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

860 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