Page Footer Sum

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

Guest

I have a report with about 50 pages, and what i'm trying to do is the sum in
every page of the report.

Detail Section
Field 1
Field 2
Field 3
Field 4 SubTotal (=[Field 1]+[Field 2]+[Field 3]+[Field 4])

Page Section
Sum of all SubTotals ???

No matter what i do or i get the #error message or the text box gets invisible

What am i doing wrong?

Thanks
PC
 
Thanks for your reply, but i get the message :
"Microsoft Access cant find the macro 'curTotal=0'."



Allen Browne said:
See:
Reports: Page Totals
at:
http://allenbrowne.com/ser-11.html

The article explains how to collect the total programmatically in the
report's events, and place it into the page footer.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Pedro Costa said:
I have a report with about 50 pages, and what i'm trying to do is the sum
in
every page of the report.

Detail Section
Field 1
Field 2
Field 3
Field 4 SubTotal (=[Field 1]+[Field 2]+[Field 3]+[Field 4])

Page Section
Sum of all SubTotals ???

No matter what i do or i get the #error message or the text box gets
invisible

What am i doing wrong?

Thanks
PC
 
Set the On Format property of the Page Header section to:
[Event Procedure]

Click the Build button (...) beside this.
Access opens the code window.

Put the line of code in there, in between the lines "Private Sub ..." and
"End Sub".

Similarly, the other lines of code have to go into the code window.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Pedro Costa said:
Thanks for your reply, but i get the message :
"Microsoft Access cant find the macro 'curTotal=0'."



Allen Browne said:
See:
Reports: Page Totals
at:
http://allenbrowne.com/ser-11.html

The article explains how to collect the total programmatically in the
report's events, and place it into the page footer.

Pedro Costa said:
I have a report with about 50 pages, and what i'm trying to do is the
sum
in
every page of the report.

Detail Section
Field 1
Field 2
Field 3
Field 4 SubTotal (=[Field 1]+[Field 2]+[Field 3]+[Field 4])

Page Section
Sum of all SubTotals ???

No matter what i do or i get the #error message or the text box gets
invisible
 
Now it gives me a "RunTime Error 94 - Invalid use of null" in the code line
"If PrintCount = 1 Then curTotal = curTotal + Me.Amount"

Allen Browne said:
Set the On Format property of the Page Header section to:
[Event Procedure]

Click the Build button (...) beside this.
Access opens the code window.

Put the line of code in there, in between the lines "Private Sub ..." and
"End Sub".

Similarly, the other lines of code have to go into the code window.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Pedro Costa said:
Thanks for your reply, but i get the message :
"Microsoft Access cant find the macro 'curTotal=0'."



Allen Browne said:
See:
Reports: Page Totals
at:
http://allenbrowne.com/ser-11.html

The article explains how to collect the total programmatically in the
report's events, and place it into the page footer.

I have a report with about 50 pages, and what i'm trying to do is the
sum
in
every page of the report.

Detail Section
Field 1
Field 2
Field 3
Field 4 SubTotal (=[Field 1]+[Field 2]+[Field 3]+[Field 4])

Page Section
Sum of all SubTotals ???

No matter what i do or i get the #error message or the text box gets
invisible
 
Use Nz() to specify zero for null:

If PrintCount = 1 Then curTotal = curTotal + Nz(Me.Amount,0)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Pedro Costa said:
Now it gives me a "RunTime Error 94 - Invalid use of null" in the code
line
"If PrintCount = 1 Then curTotal = curTotal + Me.Amount"

Allen Browne said:
Set the On Format property of the Page Header section to:
[Event Procedure]

Click the Build button (...) beside this.
Access opens the code window.

Put the line of code in there, in between the lines "Private Sub ..." and
"End Sub".

Similarly, the other lines of code have to go into the code window.

Pedro Costa said:
Thanks for your reply, but i get the message :
"Microsoft Access cant find the macro 'curTotal=0'."



:

See:
Reports: Page Totals
at:
http://allenbrowne.com/ser-11.html

The article explains how to collect the total programmatically in the
report's events, and place it into the page footer.

I have a report with about 50 pages, and what i'm trying to do is the
sum
in
every page of the report.

Detail Section
Field 1
Field 2
Field 3
Field 4 SubTotal (=[Field 1]+[Field 2]+[Field 3]+[Field 4])

Page Section
Sum of all SubTotals ???

No matter what i do or i get the #error message or the text box gets
invisible
 
Thank you very much, it really works.

PC

Allen Browne said:
Use Nz() to specify zero for null:

If PrintCount = 1 Then curTotal = curTotal + Nz(Me.Amount,0)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Pedro Costa said:
Now it gives me a "RunTime Error 94 - Invalid use of null" in the code
line
"If PrintCount = 1 Then curTotal = curTotal + Me.Amount"

Allen Browne said:
Set the On Format property of the Page Header section to:
[Event Procedure]

Click the Build button (...) beside this.
Access opens the code window.

Put the line of code in there, in between the lines "Private Sub ..." and
"End Sub".

Similarly, the other lines of code have to go into the code window.

Thanks for your reply, but i get the message :
"Microsoft Access cant find the macro 'curTotal=0'."



:

See:
Reports: Page Totals
at:
http://allenbrowne.com/ser-11.html

The article explains how to collect the total programmatically in the
report's events, and place it into the page footer.

I have a report with about 50 pages, and what i'm trying to do is the
sum
in
every page of the report.

Detail Section
Field 1
Field 2
Field 3
Field 4 SubTotal (=[Field 1]+[Field 2]+[Field 3]+[Field 4])

Page Section
Sum of all SubTotals ???

No matter what i do or i get the #error message or the text box gets
invisible
 
How to put running sum that will start from number one for every page...

I've tried to put running sum as over group only but it cant be done...its
still run over all pages.

TQ

Allen Browne said:
See:
Reports: Page Totals
at:
http://allenbrowne.com/ser-11.html

The article explains how to collect the total programmatically in the
report's events, and place it into the page footer.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Pedro Costa said:
I have a report with about 50 pages, and what i'm trying to do is the sum
in
every page of the report.

Detail Section
Field 1
Field 2
Field 3
Field 4 SubTotal (=[Field 1]+[Field 2]+[Field 3]+[Field 4])

Page Section
Sum of all SubTotals ???

No matter what i do or i get the #error message or the text box gets
invisible

What am i doing wrong?

Thanks
PC
 
If you have the code in that article working, you are already accumulating
the amount in the variable curTotal.

To display it add an unbound text box to the form's Detail section, and set
these properties:
Name txtAmountPageRS
Running Sum no
Format Currency

Then add this line to the Detail Section's Print event (after the other
one):
Me.txtAmountPageRS = curTotal

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

zyus said:
How to put running sum that will start from number one for every page...

I've tried to put running sum as over group only but it cant be done...its
still run over all pages.

TQ

Allen Browne said:
See:
Reports: Page Totals
at:
http://allenbrowne.com/ser-11.html

The article explains how to collect the total programmatically in the
report's events, and place it into the page footer.

Pedro Costa said:
I have a report with about 50 pages, and what i'm trying to do is the
sum
in
every page of the report.

Detail Section
Field 1
Field 2
Field 3
Field 4 SubTotal (=[Field 1]+[Field 2]+[Field 3]+[Field 4])

Page Section
Sum of all SubTotals ???

No matter what i do or i get the #error message or the text box gets
invisible

What am i doing wrong?

Thanks
PC
 
Thanks for the response but what i meant is i want to put a number to each
record in the page...where each page will start from 1 to 10 for
example...following page will start from 1...its nothing to do with the
amount as formulated earlier...

Normally i put control source =1 and either i tag as running sum over all or
over group.

For this case i hv 100 records and each page will have a number starting
from 1 .

Ex..page1

No Name Amount
1 Mr A 100
2 Mr B 100
3 Mr C 100
Sum Page Footer 300..(your code)

Page2
No Name Amount
1 Mr D 200
2 Mr E 100....and so on

The one that i'm trying to formulate is the No...so it will start from 1

Hope you got my msg...











Allen Browne said:
If you have the code in that article working, you are already accumulating
the amount in the variable curTotal.

To display it add an unbound text box to the form's Detail section, and set
these properties:
Name txtAmountPageRS
Running Sum no
Format Currency

Then add this line to the Detail Section's Print event (after the other
one):
Me.txtAmountPageRS = curTotal

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

zyus said:
How to put running sum that will start from number one for every page...

I've tried to put running sum as over group only but it cant be done...its
still run over all pages.

TQ

Allen Browne said:
See:
Reports: Page Totals
at:
http://allenbrowne.com/ser-11.html

The article explains how to collect the total programmatically in the
report's events, and place it into the page footer.

I have a report with about 50 pages, and what i'm trying to do is the
sum
in
every page of the report.

Detail Section
Field 1
Field 2
Field 3
Field 4 SubTotal (=[Field 1]+[Field 2]+[Field 3]+[Field 4])

Page Section
Sum of all SubTotals ???

No matter what i do or i get the #error message or the text box gets
invisible

What am i doing wrong?

Thanks
PC
 
Use the same technique as in the web page, but instead of adding the Amount,
just add 1.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

zyus said:
Thanks for the response but what i meant is i want to put a number to each
record in the page...where each page will start from 1 to 10 for
example...following page will start from 1...its nothing to do with the
amount as formulated earlier...

Normally i put control source =1 and either i tag as running sum over all
or
over group.

For this case i hv 100 records and each page will have a number starting
from 1 .

Ex..page1

No Name Amount
1 Mr A 100
2 Mr B 100
3 Mr C 100
Sum Page Footer 300..(your code)

Page2
No Name Amount
1 Mr D 200
2 Mr E 100....and so on

The one that i'm trying to formulate is the No...so it will start from 1

Hope you got my msg...


Allen Browne said:
If you have the code in that article working, you are already
accumulating
the amount in the variable curTotal.

To display it add an unbound text box to the form's Detail section, and
set
these properties:
Name txtAmountPageRS
Running Sum no
Format Currency

Then add this line to the Detail Section's Print event (after the other
one):
Me.txtAmountPageRS = curTotal

zyus said:
How to put running sum that will start from number one for every
page...

I've tried to put running sum as over group only but it cant be
done...its
still run over all pages.

TQ

:

See:
Reports: Page Totals
at:
http://allenbrowne.com/ser-11.html

The article explains how to collect the total programmatically in the
report's events, and place it into the page footer.

I have a report with about 50 pages, and what i'm trying to do is the
sum
in
every page of the report.

Detail Section
Field 1
Field 2
Field 3
Field 4 SubTotal (=[Field 1]+[Field 2]+[Field 3]+[Field 4])

Page Section
Sum of all SubTotals ???

No matter what i do or i get the #error message or the text box gets
invisible
 
I have the same scenario as Mr. Costa. I have tried all the steps that you
gave him. I did not get the exact error messages, but entered all the
information anyway. I get the following error message:

If Me is a new macro or macro group, make sure you have saved it and that
you have typed its name correctly.

What does this mean? I do not know anything about macros, and really did
not understand the code that I typed in, but tried it anyway.

Is there no other way to get a page total? This seems like a lot of code
for what should be a standard task.

In case I typed it wrong, this is how my event procedure looks:

Option Compare Database

Private Sub GroupFooter14_Format(Cancel As Integer, FormatCount As Integer)
Option Explicit 'Optional, but recommended for every module.
Dim curTotal As Currency 'Variable to sum [Amount] over a Page.
End Sub



Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If PrintCount = 1 Then curTotal = curTotal + Nz(Me.Amount, 0)


End Sub

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
curTotal = 0 'Reset the sum to zero each new Page.
End Sub
 
Mr. Browne,

I replied to the wrong part of this conversation before. I have done
everything you told him to do . I do not get any errors now, but nothing is
subtotaled. Am I supposed to put something in the unbound text box? Was
"PageTotal" supposed to go in the text box, or the label? What is supposed
to go in the text box, or am I just supposed to leave it as "unbound"?

Thank you,

Jeannie

Allen Browne said:
Use Nz() to specify zero for null:

If PrintCount = 1 Then curTotal = curTotal + Nz(Me.Amount,0)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Pedro Costa said:
Now it gives me a "RunTime Error 94 - Invalid use of null" in the code
line
"If PrintCount = 1 Then curTotal = curTotal + Me.Amount"

Allen Browne said:
Set the On Format property of the Page Header section to:
[Event Procedure]

Click the Build button (...) beside this.
Access opens the code window.

Put the line of code in there, in between the lines "Private Sub ..." and
"End Sub".

Similarly, the other lines of code have to go into the code window.

Thanks for your reply, but i get the message :
"Microsoft Access cant find the macro 'curTotal=0'."



:

See:
Reports: Page Totals
at:
http://allenbrowne.com/ser-11.html

The article explains how to collect the total programmatically in the
report's events, and place it into the page footer.

I have a report with about 50 pages, and what i'm trying to do is the
sum
in
every page of the report.

Detail Section
Field 1
Field 2
Field 3
Field 4 SubTotal (=[Field 1]+[Field 2]+[Field 3]+[Field 4])

Page Section
Sum of all SubTotals ???

No matter what i do or i get the #error message or the text box gets
invisible
 
Boy, to I feel stupid!! This conversation occurred in 2006!!

Is anyone out there who can help with this in 2009? I am using Access 2007.

Thank you!!

Jeannie said:
I have the same scenario as Mr. Costa. I have tried all the steps that you
gave him. I did not get the exact error messages, but entered all the
information anyway. I get the following error message:

If Me is a new macro or macro group, make sure you have saved it and that
you have typed its name correctly.

What does this mean? I do not know anything about macros, and really did
not understand the code that I typed in, but tried it anyway.

Is there no other way to get a page total? This seems like a lot of code
for what should be a standard task.

In case I typed it wrong, this is how my event procedure looks:

Option Compare Database

Private Sub GroupFooter14_Format(Cancel As Integer, FormatCount As Integer)
Option Explicit 'Optional, but recommended for every module.
Dim curTotal As Currency 'Variable to sum [Amount] over a Page.
End Sub



Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If PrintCount = 1 Then curTotal = curTotal + Nz(Me.Amount, 0)


End Sub

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
curTotal = 0 'Reset the sum to zero each new Page.
End Sub

Pedro Costa said:
I have a report with about 50 pages, and what i'm trying to do is the sum in
every page of the report.

Detail Section
Field 1
Field 2
Field 3
Field 4 SubTotal (=[Field 1]+[Field 2]+[Field 3]+[Field 4])

Page Section
Sum of all SubTotals ???

No matter what i do or i get the #error message or the text box gets invisible

What am i doing wrong?

Thanks
PC
 
Again: Boy, to I feel stupid!! This conversation occurred in 2006!!

Is anyone out there who can help with this in 2009? I am using Access 2007.

Thank you!!


Jeannie said:
Mr. Browne,

I replied to the wrong part of this conversation before. I have done
everything you told him to do . I do not get any errors now, but nothing is
subtotaled. Am I supposed to put something in the unbound text box? Was
"PageTotal" supposed to go in the text box, or the label? What is supposed
to go in the text box, or am I just supposed to leave it as "unbound"?

Thank you,

Jeannie

Allen Browne said:
Use Nz() to specify zero for null:

If PrintCount = 1 Then curTotal = curTotal + Nz(Me.Amount,0)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Pedro Costa said:
Now it gives me a "RunTime Error 94 - Invalid use of null" in the code
line
"If PrintCount = 1 Then curTotal = curTotal + Me.Amount"

:

Set the On Format property of the Page Header section to:
[Event Procedure]

Click the Build button (...) beside this.
Access opens the code window.

Put the line of code in there, in between the lines "Private Sub ..." and
"End Sub".

Similarly, the other lines of code have to go into the code window.

Thanks for your reply, but i get the message :
"Microsoft Access cant find the macro 'curTotal=0'."



:

See:
Reports: Page Totals
at:
http://allenbrowne.com/ser-11.html

The article explains how to collect the total programmatically in the
report's events, and place it into the page footer.

I have a report with about 50 pages, and what i'm trying to do is the
sum
in
every page of the report.

Detail Section
Field 1
Field 2
Field 3
Field 4 SubTotal (=[Field 1]+[Field 2]+[Field 3]+[Field 4])

Page Section
Sum of all SubTotals ???

No matter what i do or i get the #error message or the text box gets
invisible
 
Jeannie, I don't use Access 2007 enough to be of help to you.

However, few of the people who answer questions here use the online
interface, and, as a result, we couldn't, even if we wanted, go back to 2006
to read the thread. You will be far, far better off to create a new
question, giving the details of what you have, what you want, and what you
expect, and take it from the start again -- even if that seems extra work.

Even if I were the world's greatest Access 2007 expert (which I am certainly
not), I could not be of help because there's not nearly enough information
in this thread.

Larry Linson
Microsoft Office Access MVP


Jeannie said:
Boy, to I feel stupid!! This conversation occurred in 2006!!

Is anyone out there who can help with this in 2009? I am using Access
2007.

Thank you!!

Jeannie said:
I have the same scenario as Mr. Costa. I have tried all the steps that
you
gave him. I did not get the exact error messages, but entered all the
information anyway. I get the following error message:

If Me is a new macro or macro group, make sure you have saved it and that
you have typed its name correctly.

What does this mean? I do not know anything about macros, and really did
not understand the code that I typed in, but tried it anyway.

Is there no other way to get a page total? This seems like a lot of code
for what should be a standard task.

In case I typed it wrong, this is how my event procedure looks:

Option Compare Database

Private Sub GroupFooter14_Format(Cancel As Integer, FormatCount As
Integer)
Option Explicit 'Optional, but recommended for every module.
Dim curTotal As Currency 'Variable to sum [Amount] over a Page.
End Sub



Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If PrintCount = 1 Then curTotal = curTotal + Nz(Me.Amount, 0)


End Sub

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
curTotal = 0 'Reset the sum to zero each new Page.
End Sub

Pedro Costa said:
I have a report with about 50 pages, and what i'm trying to do is the
sum in
every page of the report.

Detail Section
Field 1
Field 2
Field 3
Field 4 SubTotal (=[Field 1]+[Field 2]+[Field 3]+[Field 4])

Page Section
Sum of all SubTotals ???

No matter what i do or i get the #error message or the text box gets
invisible

What am i doing wrong?

Thanks
PC
 
Back
Top