sub report sums problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, I am having problems trying to add together totals in the footers of
two sub-reports and placing the combined value in another unbound text box in
the footer of the main report.
The control source for the text box is taken from the names of the controls
required and reads ...

=Sum([HL-Sponsorship-GiftAidYes-Subreport].[Report]![SumGiftAidable]+[HL-Sponsorship-GiftAidYes-SubSubRpt].[Report]![GiftAidSum])

Could there be too many hyphens in the subreport names for Access to
recognise them? I have tried variations of brackets and full stops instead
of exclamation marks but to no avail.

Error message reads:
The expression you entered has a function that database can't find.
When I click OK to this, a box asking for parameter values appears.

Both subreports run off separate subqueries to the main query for filter
purposes - I don't know whether this is relevant.

Thanking you in advance for any help.
 
Usually you calculate the sums in the subreports and then reference a single
value from the subreport in your main report:
=IIf(subrpt1.Report.HasData, subrpt1.Report.txtTotal1, 0)
or if adding from two
=IIf(subrpt1.Report.HasData, subrpt1.Report.txtTotal1, 0) +
IIf(subrpt2.Report.HasData, subrpt2.Report.txtTotal2, 0)
 
Dear Duane

thanks for your help. I've just realised what I was doing wrong.. I didn't
need the word 'sum' in the control source. It now works !

(For anyone else reading my post, I also left out one of the controlnames
in the string for the control source when I typed it into the post; so that
might appear to have been the source of my problems, except that it wasn't!)

Thank you.
Duane Hookom said:
Usually you calculate the sums in the subreports and then reference a single
value from the subreport in your main report:
=IIf(subrpt1.Report.HasData, subrpt1.Report.txtTotal1, 0)
or if adding from two
=IIf(subrpt1.Report.HasData, subrpt1.Report.txtTotal1, 0) +
IIf(subrpt2.Report.HasData, subrpt2.Report.txtTotal2, 0)
--
Duane Hookom
MS Access MVP
--

ancient_hilly said:
Hello, I am having problems trying to add together totals in the footers
of
two sub-reports and placing the combined value in another unbound text box
in
the footer of the main report.
The control source for the text box is taken from the names of the
controls
required and reads ...

=Sum([HL-Sponsorship-GiftAidYes-Subreport].[Report]![SumGiftAidable]+[HL-Sponsorship-GiftAidYes-SubSubRpt].[Report]![GiftAidSum])

Could there be too many hyphens in the subreport names for Access to
recognise them? I have tried variations of brackets and full stops
instead
of exclamation marks but to no avail.

Error message reads:
The expression you entered has a function that database can't find.
When I click OK to this, a box asking for parameter values appears.

Both subreports run off separate subqueries to the main query for filter
purposes - I don't know whether this is relevant.

Thanking you in advance for any help.
 
Back
Top