Totals From Subreports into Reports

R

Robert Raley

I have a report with 3 sub reports. Two of the totals works the other does
not work when there are no records displayed.

This works:

Sub Report = rpt_manager_sub
Section = Detail
[bi_mn_pay] ( Feild from qry )

Main Report
Section = Stage_Name HEADER
[Stage_name]
Section = Detail
(This is where the 3 supreports are located)

Section = Stage_Name FOOTER

Text Box with
=Nz([rpt_manager_sub].[Report]![bi_mn_pay],0)
As Record Source

This works great.

Now this does not work

THIS DOES NOT WORK Returns "#Error" When there are no records displayed in
the sub report:

Sub Report = rpt_mod_det_sub
Section = mod_stats HEADER
[Tot_shift_pay ( Feild from qry )
Section = Detail
[add_pay] [ded_pay] ( Feilds from qry )
Section = mod_stats FOOTER
Text Box with [tot_add_pay] with control =Nz(Sum([add_pay]),0)
Text Box with [tot_ded_pay] with control =Nz(Sum([ded_pay]),0)
Text Box with [gran_tot_add_ded_pay] with control
=[tot_add_pay]+[tot_ded_pay]

Main Report
Section = Stage_Name HEADER
[Stage_name]
Section = Detail
(This is where the 3 supreports are located)

Section = Stage_Name_Footer

Text Box with
=Nz(gran_tot_add_ded_pay,0)
As Record Source

THIS DOES NOT WORK. DRIVING ME CRAZY. Give me and #Error when there are no
records in the subreport.

PLEASE HELP

Thanks

Bob
 
M

Marshall Barton

Robert said:
I have a report with 3 sub reports. Two of the totals works the other does
not work when there are no records displayed.


When a subreport has no records, its controls have no value,
not even Null.

Use this kind of reference instead of using Nz:

=IIf(rpt_mod_det_sub.Report.HasDate,rpt_mod_det_sub.Report.[tot_add_pay],0)
 
R

Robert Raley

Thanks worked like a charm once I figured out that Date was Data.

Thanks

Again.

Bob

Marshall Barton said:
Robert said:
I have a report with 3 sub reports. Two of the totals works the other does
not work when there are no records displayed.


When a subreport has no records, its controls have no value,
not even Null.

Use this kind of reference instead of using Nz:

=IIf(rpt_mod_det_sub.Report.HasDate,rpt_mod_det_sub.Report.[tot_add_pay],0)
 
M

Marshall Barton

Sorry about the typo and happy to hear you worked it out
anyway.
--
Marsh
MVP [MS Access]


Robert said:
Thanks worked like a charm once I figured out that Date was Data.

When a subreport has no records, its controls have no value,
not even Null.

Use this kind of reference instead of using Nz:
=IIf(rpt_mod_det_sub.Report.HasDate,rpt_mod_det_sub.Report.[tot_add_pay],0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top