K
Kevin
I'm building a query to filter the contents of a table of order numbers and
part numbers. The filter is a subset of the part numbers in the main table.
I need to apply the filter two different ways based on the contents of a
separate table called Toggle. If the contents of Toggle is 1 nothing is
filtered and the query returns all order numbers. If Toggle is 2 the query
returns order numbers associated with part numbers in common with the filter.
If Toggle is 3 the query returns order numbers associated with part numbers
NOT in common with the filter.
The query includes three tables; ORDERS, FILTER and TOGGLE. All tables are
linked to external data that I cannot change. The ORDERS table contains
fields ORDERNUM and PARTNUM which I've added to my query. For the sake of
this discussion the possible values of PARTNUM are AB, AC, AD, AE, AF and AG.
The FILTER table can contain one, two but no more than three part numbers.
The TOGGLE table contains a single value; 1, 2 or 3.
PARTNUM criteria looks like this.
IIf([TOGGLE]![PARTNUMTOGGLE]=1,([ORDERS].[PARTNUM]),IIf([TOGGLE]![PARTNUMTOGGLE]=2,([ORDERS].[PARTNUM])
Not Like [FILTER]![PARTNUMFILTER],[FILTER]![PARTNUMFILTER]))
The query seems to work for PARTNUMTOGGLE values of 1 and 3. But when
PARTNUMTOGGLE = 2 the query returns nothing. I've also tried using "<>" in
lieu of "Not Like" but with the same results.
Any help with be greatly appreciated.
Thank you.
Kevin
part numbers. The filter is a subset of the part numbers in the main table.
I need to apply the filter two different ways based on the contents of a
separate table called Toggle. If the contents of Toggle is 1 nothing is
filtered and the query returns all order numbers. If Toggle is 2 the query
returns order numbers associated with part numbers in common with the filter.
If Toggle is 3 the query returns order numbers associated with part numbers
NOT in common with the filter.
The query includes three tables; ORDERS, FILTER and TOGGLE. All tables are
linked to external data that I cannot change. The ORDERS table contains
fields ORDERNUM and PARTNUM which I've added to my query. For the sake of
this discussion the possible values of PARTNUM are AB, AC, AD, AE, AF and AG.
The FILTER table can contain one, two but no more than three part numbers.
The TOGGLE table contains a single value; 1, 2 or 3.
PARTNUM criteria looks like this.
IIf([TOGGLE]![PARTNUMTOGGLE]=1,([ORDERS].[PARTNUM]),IIf([TOGGLE]![PARTNUMTOGGLE]=2,([ORDERS].[PARTNUM])
Not Like [FILTER]![PARTNUMFILTER],[FILTER]![PARTNUMFILTER]))
The query seems to work for PARTNUMTOGGLE values of 1 and 3. But when
PARTNUMTOGGLE = 2 the query returns nothing. I've also tried using "<>" in
lieu of "Not Like" but with the same results.
Any help with be greatly appreciated.
Thank you.
Kevin