Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Print page of page on group footer, not pagefooter

Posted on 2015-02-19
4
Medium Priority
?
148 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 51

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 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 2000 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 58
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

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

661 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