report totals

A

AttackIP

I have about 500 records capturing pilot data: flight time, day landings,
night landings, instrument approaches, ... The logbook report I created
shows 20 records per page, ascending by date. I'd like to total these
various columns for each page of the report, and carry the totals over to the
subsequent page to be added to that page totals, and so on. I currently
can't even get totals for the first page, much less subsequent pages.

I'm pretty handy with Access, but a pilot by trade (need a fairly dummy
proof explanation!)
Thanks
 
S

Steve Schapel

AttackIP,

Make a copy of each control in the report's Detail section that you want
this for. For example, put a second textbox bound to the [day landings]
field, let's say you name this textbox rs_day. Set the Visible property
of this textbox to No, and its Running Sum property to Over All. Then,
in the Page Footer section of the report, put an unbound textbox, and
set its Control Source to =[rs_day]. Hope that will do what you want.
 
A

AttackIP

Steve,

Thank you, that took care of my page totals... Now, can I forward each
pages totals to the next page and add it to that pages totals?

Thnak you,

JD
 
S

Steve Schapel

JD,

The total at the bottom of the 2nd page should be the total of pages 1
plus 2. The total at the bottom of the 3rd page should be the total of
pages 1 plus 2 plus 3. Etc. What else do you want?
 
A

AttackIP

Steve,

Duh, you're right, after doing it I had only looked at the bottom of the
first page. What if I want totals for each seperate page. That, and your
previous help would cover everything I need.

Thanks,
JD
 
S

Steve Schapel

JD,

Well, totals for each separate page starts to get tricky, and requires
the use of VBA code. Try it like this...

- In the Page Footer section, put an unbound textbox and name it
DayLandingsPerPage.
- In the report's module, at the top where it says Option Compare
Database and Option Explicit, add a line like this...
Dim DayLandingsPageTotal As Integer
- In the Format event of the Page Header section of the report, put a
line of code like this...
DayLandingsPageTotal = 0
- In the Print event of the Detail section of the report, put code
like this...
If PrintCount = 1 Then
DayLandingsPageTotal = DayLandingsPageTotal + Me.Day_Landings
End If
- In the Format event of the Page Footer section, put code like this...
Me.DayLandingsPerPage = DayLandingsPageTotal
- Repeat the above for each figure you want a page total for.
 
A

AttackIP

Steve Schapel said:
JD,

Well, totals for each separate page starts to get tricky, and requires
the use of VBA code. Try it like this...

- In the Page Footer section, put an unbound textbox and name it
DayLandingsPerPage.
- In the report's module, at the top where it says Option Compare
Database and Option Explicit, add a line like this...
Dim DayLandingsPageTotal As Integer
- In the Format event of the Page Header section of the report, put a
line of code like this...
DayLandingsPageTotal = 0
- In the Print event of the Detail section of the report, put code
like this...
If PrintCount = 1 Then
DayLandingsPageTotal = DayLandingsPageTotal + Me.Day_Landings
End If
- In the Format event of the Page Footer section, put code like this...
Me.DayLandingsPerPage = DayLandingsPageTotal
- Repeat the above for each figure you want a page total for.

Steve,
What are the "Me.Day_Landings" and the " Me.DayLandingsPerPage" from the
code? I guess I'm asking what do they refer to, and what do they do?
Additionally, after entering the code, when I try to run the report I get a
"Access can't find the macro 'DayLandingsPageTotal=0' "

Thank you for your time,

JD
 
S

Steve Schapel

JD,

It sounds like you have typed "DayLandingsPageTotal=0" directly into the
property sheet for the event concerned, is that right? No, this is
supposed to go into the class module behind the report.
Me.DayLandingsPerPage refers to the unbound control that you put on the
Page Footer, as per the first step in the instructions.
Me.Day_Landings refers to the field you are trying to get the total
of... from your original post, I infer that you have a textbox in the
Detail section of the report called [day landings]?
 
A

AttackIP

Steve,

I got all of the code into the appropriate places. When I run the report it
halts on:

Runtime error 94 Invalid Use of Null

When I click on Debug, it refers to the following code: (with the 3rd line
highlighted)

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If PrintCount = 1 Then
InstAppPageTotal = InstAppPageTotal + Me.InstApp
End If
End Sub

In my table, there are null values for many circumstances. ie A day flight
would result in No night landings, or clear weather may result in No
Instrument Approaches. Not sure if that's the issue or not.
"InstApp" Instrument Approaches happens to be the first column of the report.
Hope you've got great patience... Thanks,

JD
 
S

Steve Schapel

JD,

If this is what I think it is, you can handle the fact of no data in the
fields like this...
InstAppPageTotal = InstAppPageTotal + Nz(Me.InstApp, 0)
 
A

AttackIP

Steve,
You ARE the man. I started this database for myself and I've been adding
flight data for about three years. The reports I created do everything I
need with the exception of the one you've been helping me with, and I've been
trying to nug my way through it off and on for a couple of months. Finally,
I"ll be able to go to bed at a decent hour (my wife is very appreciative)...
God bless developers! I suspect you may do this voluntarily, but either way
I'd like to forward my thanks to someone higher up the ladder (provided there
is a ladder?). Thanks a ton!!

JD
 
S

Steve Schapel

JD,

I can certainly relate to the feeling of getting things working how you
want them, after a struggle. I am happy to know that you have reached
this point (for now!) with your project. Yes, the contributions made in
these newsgroups is voluntary. The "Lead" for Access MVPs is Suzanna
Moran suzannam-at-microsoft.com
 
W

Walter Steadman

Attack IP,
You wouldn't happen to be in the 42d ID would you?
I am in the AVN BDE S-6 shop there. Playing with Access myself. Trying to
build something to replace AFRS system.

Wally Steadman
 

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