Solved

Print page of page on group footer, not pagefooter

Posted on 2015-02-19
4
135 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…

911 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

22 Experts available now in Live!

Get 1:1 Help Now