Solved

Print page of page on group footer, not pagefooter

Posted on 2015-02-19
4
132 Views
Last Modified: 2015-02-24
Is there a way to print page of page on a group footer of a report, not the page footer?  In other words, say I have a report grouped by salesperson... I'd like each salesperson's information to start on a new page of the report and have that group have it's own page of page information starting with 1 printed on the group footer.

Can this be done?
0
Comment
Question by:SteveL13
  • 2
4 Comments
 
LVL 49

Expert Comment

by:Gustav Brock
Comment Utility
Couldn't you have a textbox in the page footer, txtPageInfo:

    =[Page] & " of " & [Pages]

Then, in your group footer, refer to that:

    =[txtPageInfo]

/gustav
0
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
Comment Utility
Yes. it can be done.

But consider that if you start a new page each time the salesperson changes, the page footer is going to be the same as the group footer, so it doesn't matter where you put it and it's generally  better in the page footer, because it will always appear at the bottom of the page.

 To do X of Y over a group, you need to resort to some code.  Here's how you do it:

1.  On your report, place a hidden control in the page footer with it's control source set to:

=[Page] & " of " & [Pages]

2. At the top of the reports code module put:

Private varGrpArrayPage()
Private varGrpArrayPages()
Private varGrpNameCurrent As Variant
Private varGrpNamePrevious As Variant
Private intGrpPage As Integer
Private intGrpPages As Integer

3. In the page footers OnFormat event, put:

    Dim intI As Integer
   
    If Me.Pages = 0 Then
        ReDim Preserve varGrpArrayPage(Me.Page + 1)
        ReDim Preserve varGrpArrayPages(Me.Page + 1)
        varGrpNameCurrent = Me.txtCourseName
        If varGrpNameCurrent = varGrpNamePrevious Then
            varGrpArrayPage(Me.Page) = varGrpArrayPage(Me.Page - 1) + 1
            intGrpPages = varGrpArrayPage(Me.Page)
            For intI = Me.Page - ((intGrpPages) - 1) To Me.Page
                varGrpArrayPages(intI) = intGrpPages
            Next intI
        Else
            intGrpPage = 1
            varGrpArrayPage(Me.Page) = intGrpPage
            varGrpArrayPages(Me.Page) = intGrpPage
        End If
    Else
        Me!txtGrpPages = "Page " & varGrpArrayPage(Me.Page) & " of " & varGrpArrayPages(Me.Page)
    End If
   
    varGrpNamePrevious = varGrpNameCurrent

Note this line in the above:

     varGrpNameCurrent = Me.txtCourseName

  That has to be set to pickup the key of the group (for example, salesperson ID).

4. In the page footer, add a control called txtGrpPages

 Don't forget on the Groups footer to set it to force a page after the section.

Jim.
0
 

Author Comment

by:SteveL13
Comment Utility
Jim,

WOW!  Thanks.  I only have one issue.  The report has a report footer.  For some reason the last group says page 1 of 2, there is only one page for the group), because it's counting the report footer, which is a page of its own, as the 2nd page even though it shouldn't be counted in the groups x of x text box.

??
0
 
LVL 57

Expert Comment

by:Jim Dettman (Microsoft MVP/ EE MVE)
Comment Utility
That is more or less correct; the last group occupies the last two pages of the report because there is no next group.

another way to say that; if the report footer had fallen on the same page as the group footer, then the group would read 1 of 1.

Jim.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now