View Full Version : How to calculate SUM() from subReport to Mainreport


AccessFreak
10-20-2009, 03:21 AM
I have 2 subreports in my detail section. In the footer of each subreport I have a number exclusive VAT. That works BUT.. read on.

The total of both have numbers need to be calculated to the mainreport.

This is called the Total exclusive VAT. That doesn't work... It says cant find the controls on the subreport.

Under the Total Exclusive VAT there need to be a Total Inclusive VAT.

The statement I used for the control in the subreport is:
= Sum([Time]*[Price])

The statement I used for the control in the Mainreport is:
= Sum ([Subreport_Taken].[Report]![txt_TotalExclVAT]+[Subreport_].[Report]![txt_TotalExclVAT])

The second doesn't work...

Rich
10-20-2009, 03:52 AM
Use the HasData method, examples have been posted here

GalaxiomAtHome
10-20-2009, 04:28 AM
I don't fully understand the problem.
However it seems you should simply be adding the two controls from the subforms.

Moreover Sum() applies to the fields in the RecordSet of the form not the controls on the form. You can't Sum controls as they only contain the value of the current record.

Rich
10-20-2009, 11:15 AM
There's a simple example here
http://www.access-programmers.co.uk/forums/showthread.php?t=155742