Report Subtotal

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?
 
M

Marshall Barton

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
 

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