Filtering mutiple queries from one combobox

papadega3000

Registered User.
Local time
Yesterday, 23:43
Joined
Jun 21, 2007
Messages
80
I have form that displays mutiple queries in pages (the queries are subforms). What I am trying to accomplish is that upon selection of a value in the combobox I want to have the ability to filter all the queries based on that value. Currently, I can get it to work halfway where the filters I created work for two of the 4 queries I make.

The relationships I have defined are as follows:

Test_Case.Test_Case -> Run.Test_Case (1-many)
Run.Run -> Task.Group (1-many)
Task.Task -> Dr_task.Task (1-many)

I make 4 queries that I would like to filter on the following tables.

TestCase
Run
Task
DR

Using those relationships I can make a query work for filtering Test_Case and Run queries but I cannot seem to construct criteria to filter the Task or DR's.

The way i did the first two is below:
Code:
'Filters Test_Case by comboTestCase
IIf(IsNull([Forms]![]![ComboStatusTestCase]),[Test_Case],[Forms]![Status]![ComboStatusTestCase])));
 
 
' Filters Runs by comboTestCase
IIf(IsNull([Forms]![ConductChecklist]![ComboTestCase]),[Test_Case],[Forms]![ConductChecklist]![ComboTestCase]) Or IIf(IsNull([Forms]![ConductChecklist]![ComboTestCase]),[Run.Test_Case],[Forms]![ConductChecklist]![ComboTestCase])

I guess my question is how can I manipulate what I have already constructed to filter by test cases even though the tables that I want to query don't have a test case field in it.

Ex. In the run table I have Run.Run field which is related to Task.Group Since Run.Run and Run.Test_Case in the run field I want to somehow filter Tasks that have Group equal to a Run.Run that has the Run.Test_case value selected. I figured it would be a couple nested IIF()'s but I am not sure how to construct it so it works. My attempts leave me with a blank query most of the time.

I attached a pic of the relationships for a visual.
 

Attachments

  • relationships.JPG
    relationships.JPG
    99.8 KB · Views: 138
I actually figured this issue out on my own. I had the right concept however it was not filtering correctly because I wasn't using the relationships correctly. In the one case I wasn't filtering on test case simply because I wasn't select test case in the query so the parameter passed did nothing. This was corrected. I basically had to add another field to each query and add the Run table to the query with the Run.Test_Case field being filtered. This way it preserved the relationships that I had already in exisitence.
 

Users who are viewing this thread

Back
Top Bottom