Avatar of CMILLER
CMILLER
Flag for United States of America asked on

Access 2007 Criteria

I have a field in a query that has a long criteria, is there a way to shorten it?

Current Criteria:

Like "13-*T" Or Like "13-*A" Or Like "13-*M" Or Like "13-*B" Or Like "13*F" Or Like "14-*T" Or Like "14-*A" Or Like "14-*M" Or Like "14-*B" Or Like "14*F"

The numbers are the year.
Microsoft Access

Avatar of undefined
Last Comment
CMILLER

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Donnaa5dcp

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Dale Fye

Rather than use the LIKE or IN operators, which are notoriously slow, I would do something similar to:

WHERE (Left([FieldName],2) = "13" OR Left([FieldName],2) = "14")
AND (Right([FieldName], 1) = "T" OR Right([FieldName], 1) = "A" OR Right([FieldName], 1) = "M" OR Right([FieldName], 1) = "B" OR Right([FieldName], 1) = "F")

Depending on the size of your recordset, this would probably be much more efficient.
CMILLER

ASKER
ok, thanks!
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy