Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Print page of page on group footer, not pagefooter

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

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
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.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

885 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