![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have 2 reports that both use the same subreport. The linking filed is MemHeadOfHouseID. They are RptPaymentRecord & RptPaymentRecordUnPaid. The query for the sub is long and irrelevant, and contains user defined functions which slow it down. It runs much faster if I filter it on MemHeadOfHouseID (only returns a few records instead of many hundred) The filter I am trying to apply is:- IIf(IsReportLoaded("RptPaymentRecord"),[Reports]![RptPaymentRecord]![MemHea*dOfHouseID],IIf (IsReportLoaded("RptPaymentRecordUnPaid"),[Reports]![RptPaymentRecordUnPaid*]![MemHeadOfHouseID])) The IsReportLoaded function just returns True or False If I run the RptPaymentRecord report, I get asked for the parameter [Reports]![RptPaymentRecordUnPaid]! [MemHeadOfHouseID] – the one I am not needing If I just run the query, I get asked for both parameters. What I want to achieve is that if neither report is open, there should beno request for parameters, and all records should be displayed in the query. If one or other report is open, only the records with the same MemHeadOfHouseID should print, and of course, no request for the other parameter. I know I can get over it with 2 queries and 2 subreports to go with the 2 main reports, but feel that this should be unnecessary. Ideas please Thanks Phil |
#3
| |||
| |||
|
|
On Nov 9, 11:40*am, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote: I have 2 reports that both use the same subreport. The linking filed is MemHeadOfHouseID. They are RptPaymentRecord & RptPaymentRecordUnPaid. The query for the sub is long and irrelevant, and contains user defined functions which slow it down. It runs much faster if I filter it on MemHeadOfHouseID (only returns a few records instead of many hundred) The filter I am trying to apply is:- IIf(IsReportLoaded("RptPaymentRecord"),[Reports]![RptPaymentRecord]![MemH ea*dOfHouseID],IIf (IsReportLoaded("RptPaymentRecordUnPaid"),[Reports]![RptPaymentRecordUnPa id*]![MemHeadOfHouseID])) The IsReportLoaded function just returns True or False If I run the RptPaymentRecord report, I get asked for the parameter [Reports]![RptPaymentRecordUnPaid]! [MemHeadOfHouseID] – the one I am n ot needing If I just run the query, I get asked for both parameters. What I want to achieve is that if neither report is open, there should be no request for parameters, and all records should be displayed in the query. If one or other report is open, only the records with the same MemHeadOfHouseID should print, and of course, no request for the other parameter. I know I can get over it with 2 queries and 2 subreports to go with the 2 main reports, but feel that this should be unnecessary. Ideas please Thanks Phil Why not just call a function instead of all the IIFs()? Ex: FieldToUse(Me.ReportName). Let the function return the processed and correct value? |
![]() |
| Thread Tools | |
| Display Modes | |
| |