adding a total from a subreport to total on main report

  • Thread starter Thread starter Lorna
  • Start date Start date
L

Lorna

I have a total on my main report and a total on my
subreport. If there is a value in both, then my grand
total works great. However, if either one does not have a
value, my grand total shows #Error. I would like to "add"
a zero in place of the missing total, but cannot figure
out how. Can someone help please?

Also, is there a way to print or not print the page, based
on the grand total (totals on the report, not in a query)?

TIA

Lorna
 
Lorna said:
I have a total on my main report and a total on my
subreport. If there is a value in both, then my grand
total works great. However, if either one does not have a
value, my grand total shows #Error. I would like to "add"
a zero in place of the missing total, but cannot figure
out how. Can someone help please?
Make your main report totals field an unbound with no data source. In the
header section before the subreport, add code to put a zero in the totals
control. In the subreport in the totals footer, add code to copy the
subreport total to the main report totals control. That way you get zero if
there's no subreport, or the amont if there is a subreport.
Jack Peacock
 
You can reference the HasData property of both your main report and your
subreport:
=IIf([HasData], [MainRptCntrl],0) + IIf(srptCtrl.Report.[HasData],
srptCtrl.Report.[subRptCntrl],0)
 
Back
Top