MS Access Like statement with multiple values

Posted on 2008-11-17
Medium Priority
Last Modified: 2012-05-05
Hi All,

I am writing an access application for our company and have come across a problem thats been bugging me.

i need to do a like statement for 2 values in the same field

example i need to select products with the prefix 01 and 21

i tried this

SELECT ItemNumber FROM tblProducts WHERE ItemNumber Like '01*' AND ItemNumber Like 21

but it didnt work when i do a like with just 01 or just 21 it works fine, is there a way i can filter it by just these two?
Question by:paul612
LVL 93

Accepted Solution

Patrick Matthews earned 1000 total points
ID: 22980425
SELECT ItemNumber FROM tblProducts WHERE ItemNumber Like "01*" OR ItemNumber Like "21*"
LVL 26

Assisted Solution

tigin44 earned 1000 total points
ID: 22980427
SELECT ItemNumber FROM tblProducts WHERE ItemNumber Like '01*' OR ItemNumber Like '21*'

will brougt you alll the items with the prefixex 01 and 21.
LVL 75
ID: 22980435
SELECT ItemNumber FROM tblProducts WHERE ItemNumber IN (01,21)


Author Closing Comment

ID: 31517665
I split the points as you both said the same thing at the exact same posting time, i didnt even think to try OR my brain isnt working today at all

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

839 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