Report Subtotal

  • Thread starter Thread starter Theresa
  • Start date Start date
T

Theresa

I am using Access 2007. I have created a report based on a query. In the
query I have created a calculated field and I have included this field in the
detail section of my report. I want to be able to subtotal this field on my
report. I created the text box in the page footer, but keep getting #Error
as the result.

Why is this not working?
 
Theresa said:
I am using Access 2007. I have created a report based on a query. In the
query I have created a calculated field and I have included this field in the
detail section of my report. I want to be able to subtotal this field on my
report. I created the text box in the page footer, but keep getting #Error
as the result.

Why is this not working?


Because a page is not a data specified set of values. You
can use the Sum function on the entire report and/or any
level of report grouping, but not in a page header or
footer.

If you really need to get page subtotals, use a running sum
text box in the detail section and some code:

This line goes at the top of the report module, before any
sub or function procedures.
Dim PreviosPageTotal

Put this kibd of thing in the page footer section's Print
(or Format) event.
Me.[page footer text box] = Me.[running sum text box] -
PreviosPageTotal
PreviosPageTotal = Me.[running sum text box]

It might not be necessary in your case, but you shouldalso
add a line of code in the report header section's Print (or
Format) event:
PreviosPageTotal = 0
 
Back
Top