Multiple Numbers Or'd as criteria from Form

  • Thread starter Thread starter JoeWM
  • Start date Start date
J

JoeWM

I have an autonumber key field in a query that I want to
filter based on a field in the current record on a form.
If the field on the form has one number in it, such
as "1550", the query filters appropriately. But if the
field has two numbers separated by OR, such as "1550 OR
2385", the query finds no records. If I enter "1550 OR
2385" directly into the query criteria manually, it
filters appropriately. Help, please.
 
When putting multiple choices into SQL, you must specify
the column qualifier each time e.g.
column1 = 1550 OR column1 = 2385
This is done automatically when you use the Query Design
and put 1550 OR 2385 into the criteria.
My personal preference is to use the IN clause as it is
less to type and reads better e.g.
column1 IN (1550, 2385)

Hope That Helps
Gerald Stanley MCSD
 
Back
Top