Sum total from Subreport

G

Guest

I have a subreport in the detail section of my main report. I link the
results from the subreport to a primary ID on the main report through the
subreport's underlying query. On the subreport I sum the results of the # of
tickets in a group footer. The group footer is hidden. On the main report I
reference the total # of tickets from the subreport to a control in the group
footer on the main report. For some odd reason it works for others, except
one record. Why is this? Is this the best method or should I use a
different approach? When I look at the results of the subreport for that
record, it doesn't appear any differently than similar records. I am lost.
 
A

Allen Browne

This will fail if:
a) there are no records in the subreport, or
b) Access misunderstands the data type.

To avoid a), test the HasData property of the report in the subreport
control.
To avoid b), use Nz() to convert a null to zero, and set the Format of the
text boxes to specify the data type.

The Control Source of the text box on your main report will end up like
this:
=IIf([Sub1].[Report].[HasData], Nz([Sub1].[Report].[txtTotal], 0), 0)

Set the Format property to Currency or General Number as appropriate. It
would be a good idea to set the Format of the hidden text box in the Report
Footer section of the subreport also.
 

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