Filters and reports...

thhakala

New member
Local time
Today, 20:46
Joined
Jun 28, 2001
Messages
7
... don't mix too well.
Fox example now I have a report which has several subreports. The subreport has an on open event:

Me.Filter = Forms![Form-X].Filter
Me.FilterOn = True

This works fine when opening the subreport alone. But when opening the actual report (that holds the subreport) - the filter in the subreport doesn't work.

So how the h*ll am I supposed to use the filter from a form in a subreport?

Thanks guys.
 
Did you try to refer to your subreports with its whole name?

Reports![MainReportName]![SubreportName].Report
 
Hi thhakala

I would have thought that it would be preferable to use criteria in your queries underlying the report and subreports (I am assuming your report and subreports draw on queries rather than the table). With queries and parameters set up properly I don't think it is necessary to use a filter (and your parameters/criteria can be based on a combo box or text field or be the kind of parameters that open a prompt window for your user).

Also make sure your subreports are properly linked to the main report in terms of the Child and Parent links - this can be another way that filtering automatically takes place (as the records in the subreport are linked to a Primary Key, usually, in the main report).

I have a number of very sophisticated/complicated reports (with numerous subreports and even sometimes subreports within subreports) and I cannot remember once needing to use a filter.

HTH

Rich Gorvin

[This message has been edited by Rich@ITTC (edited 07-23-2001).]
 
Thanks, SunWuKung and Rich.

Though the problem still remains unsolved.

SunWuKung, I tried to use the reports full name but still not working.

Rich, The data source for the subreport is actually a table, and not a query.
In the form, where the user does his selections (several text fields and combo boxes) the selections are combined with Visual Basic and used as a filter for the table data.
This, in my experience and opinion, is slightly faster and than doing a huge query with lots of "<> Null" fields and stuff. (And the Access 2000 SQL-editor being what it is. And me being rather a programmer than a drag&drop-person.)

There would be no problem if the subreports were regular subreports, being linked to the main report by some field. But this is not the case here - the subreports are actually completely independent of the main report. The main report has no source data, it only holds the subreports.

Well. Confused enough, coffee hour
wink.gif
 

Users who are viewing this thread

Back
Top Bottom