Link to home
Start Free TrialLog in
Avatar of Chris Miller
Chris MillerFlag 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.
ASKER CERTIFIED SOLUTION
Avatar of Donnaa5dcp
Donnaa5dcp
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 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.
Avatar of Chris Miller

ASKER

ok, thanks!