Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot create a running total for each report page

Status
Not open for further replies.
Jul 5, 2001
40
US
I need to have a running total for each page so that values can be checked for valid input or invalid input. I would like the total to be somewhere other than in the detail, but this will work fine if it's the only way possible to do it. I've tried the following however:

1. I've tried an unbound text box and assigning it =Sum[TotalAmount] as the control source. This doesn't work unless it's in the REPORT footer or header but only displays on the first or last page depending on the location.

2. I've tried an unbound text box assigning it as a running total box, this works for the first page but continues to total on each page thereafter, not starting over. This works but it's not what I'm trying to do.

3. I've tried to place a piece of vb code to add the items together as the data is read in, but it has the same problem of totaling ALL numbers together instead of just the page I am looking at.

Any suggestions would be quite helpful.

Thanks.
 
Just a guess, but can you set the value back to zero On Format of your page Header?
 
Sorry, I remembered where that thought came from, and it was setting page numbers, which isn't quite the same.

What does happen if you set the Running Sum property to Over Group in the page footer?
 
Thanks for your help, but I got it to work using the following from Microsoft.


Although on their code I changed the following:

Where they tell you to create a text box labled PageSum I created a double like so:

Public PageSum As Double

Then the assignment went something like this:

In the General Declarations I have the following:

Public X As Double
Public PageSum As Double

Create a Text box with the name [RunSum]. Bind the control source to the field [AmountTotal] and placed it in the detail (this is the number I am trying to make page totals for). Then the rest of the code goes as follows:

Private Sub PageFooterSection_Print(Cancel As Integer, PrintCount As Integer)

PageSum = Me!RunSum - X
X = Me!RunSum

End Sub


Then I have another text box located in my page footer, with the control source as =([PageSum]).

This seemed to work great. I had a heck of a time with this one. Thanks for you help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top