Solved

Print page of page on group footer, not pagefooter

Posted on 2015-02-19
4
144 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 50

Expert Comment

by:Gustav Brock
ID: 40620712
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
ID: 40620950
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
ID: 40621168
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
ID: 40621206
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

734 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