Access Reports Filtering

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all

I have a master form and two subforms linked by a related field. I have a
command button which when pressed invokes a report wherein I filter for the
record being shown on the screen currently. Now I want to specify that I want
to print only those records from the subform where the subforms field value
is 'Y'

ie child table can have 20 records out of which I flag only 5 to be printed.
i already have the filter condition for master. How do I add filter for the
child table along with it ?

Thanks
Madhuri
 
On the same form from which you call the report with the button click (let's
call that Form1), have a combo box where you enter or select the filter for
the subreport (assuming you will be using a subreport for the subform portion
of the data), for example, Combo1 whose row source is value list "Y;N" &
Limit to List is True.

Now, in the data source of the subreport, the select statement will look
something like this:

SELECT * from Table2 where Field1 = [Forms]![Form1]![Combo1]. Because it is
a subreport, it will already be linked & thus filtered by the child/parent
field, but this allows you to specify an output filter (in the example above,
"Y" or "N") before you open the report.
 
Back
Top