Solved

Filtering using "contains"

Posted on 2006-11-09
4
457 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now