Adding totals on subreports?t

T

Tony

Hi Group,

I am having problems calculating an overall 'total' figure
on my main report (rptFarmerDetails). I have 6
subforms/subreports on my report and each
subform/subreport has a text box (txtTotal) in the footer
to calculate a total sum (i.e. =Sum([Amount]). I would
like to add the 6 txtTotals to get an overall total but it
is not working and keeps throwing up a parameter box
asking for values. Further to this if no records exisit
then the subform/subreport will not display so this will
affect the calculation - I think I need an if statement
but am not sure how to program it.

Here is the calculation that I have produced using the
expression builder to produce the overall total.

=Sum([Child77].[Report]![txtTotal]+[Child52].[Report]!
[txtTotal]+[Child70].[Report]![txtTotal]+[Child74].
[Report]![txtTotal]+[Child75].[Report]![txtTotal]+
[Child76].[Report]![txtTotal])

Can someone show me where I'm going wrong.
Grateful for all help

Tony
 
D

Duane Hookom

You can't Sum() controls like this. You can add the values of controls from
the subreports. To avoid issues with subreports not returning records, use
syntax like:
=IIf(Child77.Report.HasData, Child77.Report!txtTotal,0) + ...
 
T

Tony

Excellent stuff Duane,
Worked a treat...learnt something new there.

Tony
-----Original Message-----
You can't Sum() controls like this. You can add the values of controls from
the subreports. To avoid issues with subreports not returning records, use
syntax like:
=IIf(Child77.Report.HasData, Child77.Report!txtTotal,0) + ...

--
Duane Hookom
MS Access MVP


Hi Group,

I am having problems calculating an overall 'total' figure
on my main report (rptFarmerDetails). I have 6
subforms/subreports on my report and each
subform/subreport has a text box (txtTotal) in the footer
to calculate a total sum (i.e. =Sum([Amount]). I would
like to add the 6 txtTotals to get an overall total but it
is not working and keeps throwing up a parameter box
asking for values. Further to this if no records exisit
then the subform/subreport will not display so this will
affect the calculation - I think I need an if statement
but am not sure how to program it.

Here is the calculation that I have produced using the
expression builder to produce the overall total.

=Sum([Child77].[Report]![txtTotal]+[Child52].[Report]!
[txtTotal]+[Child70].[Report]![txtTotal]+[Child74].
[Report]![txtTotal]+[Child75].[Report]![txtTotal]+
[Child76].[Report]![txtTotal])

Can someone show me where I'm going wrong.
Grateful for all help

Tony


.
 

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