dbTalk Databases Forums  

Parameters not needed

comp.databases.ms-access comp.databases.ms-access


Discuss Parameters not needed in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Phil
 
Posts: n/a

Default Parameters not needed - 11-09-2011 , 11:40 AM






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]![MemHeadOfHouseID],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 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

Reply With Quote
  #2  
Old   
Patrick Finucane
 
Posts: n/a

Default Re: Parameters not needed - 11-09-2011 , 12:34 PM






On Nov 9, 11:40*am, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote:
Quote:
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
Why not just call a function instead of all the IIFs()? Ex:
FieldToUse(Me.ReportName). Let the function return the processed and
correct value?

Reply With Quote
  #3  
Old   
Phil
 
Posts: n/a

Default Re: Parameters not needed - 11-10-2011 , 06:36 AM



On 09/11/2011 18:34:33, Patrick Finucane wrote:
Quote:
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?

Good idea

Function WhichReport(ID As Long) As Long
' Called by query QRptSpaceBoat

If IsReportLoaded("RptPaymentRecord") Then
WhichReport = Reports!RptPaymentRecord!MemHeadOfHouseID
Exit Function
End If

If IsReportLoaded("RptPaymentRecordUnPaid") Then
WhichReport = Reports!RptPaymentRecordUnPaid!MemHeadOfHouseID
Exit Function
End If

WhichReport port = ID ' Neither report open, so return the MemHeadOfHuuseID

End Function

Works a treat

Thanks

Phil

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.