C
Carma via AccessMonster.com
Ok I'm trying to create a query which will be the basis for a report. Now
the query results will be determined by selections made by the user on a form
called frmLists. The form will have up to five separate list boxes, but
we'll work with two for this discussion:
List 1 List 2
null null
A 1
B 2
C 3
D 4
I want the user to be able to select items form either or both list boxes and
then the query will select the correct records based upon the selected. I
thought about using separate check boxes under each list for the user to
check if they want to use 'that' list as part of the filter, but maybe there
is a better way. For List 1 I had Checkbox1 and for List 2 I had Checkbox2.
The query uses data from one table only called tblPositions. So in the query
I set up the criteria/filter for the appropriate field, say on List 2 as iif(
[Checkbox2] =-1,[List 2]) So I thought that if the user selected check box 2
it would filter by the selected list item in List 2 and that if they didn't
select check box 2 then it wouldn't filter by anything. But there are two
problems.
1) If check box isn't selected the query doesn't show any results implying to
me at least that it is filtering by a value that doesn't match anything in
the records. So I thought that I basically need the Else part of the logic
stmt above to either have no filters or somehow list all possible data
inclusions as filters but I didn't know how to do this. maybe there is a
better way too.
2) Second problem is even when checkbox2 is selected but the user selects
'empty' or null item on the list then the query comes back with no results
again even though I know the table has many records with an empty value for
this field.
Please help me and let me know if I wasn't clear in my description of the
problem.
Thanks for your help!
the query results will be determined by selections made by the user on a form
called frmLists. The form will have up to five separate list boxes, but
we'll work with two for this discussion:
List 1 List 2
null null
A 1
B 2
C 3
D 4
I want the user to be able to select items form either or both list boxes and
then the query will select the correct records based upon the selected. I
thought about using separate check boxes under each list for the user to
check if they want to use 'that' list as part of the filter, but maybe there
is a better way. For List 1 I had Checkbox1 and for List 2 I had Checkbox2.
The query uses data from one table only called tblPositions. So in the query
I set up the criteria/filter for the appropriate field, say on List 2 as iif(
[Checkbox2] =-1,[List 2]) So I thought that if the user selected check box 2
it would filter by the selected list item in List 2 and that if they didn't
select check box 2 then it wouldn't filter by anything. But there are two
problems.
1) If check box isn't selected the query doesn't show any results implying to
me at least that it is filtering by a value that doesn't match anything in
the records. So I thought that I basically need the Else part of the logic
stmt above to either have no filters or somehow list all possible data
inclusions as filters but I didn't know how to do this. maybe there is a
better way too.
2) Second problem is even when checkbox2 is selected but the user selects
'empty' or null item on the list then the query comes back with no results
again even though I know the table has many records with an empty value for
this field.
Please help me and let me know if I wasn't clear in my description of the
problem.
Thanks for your help!