Jumat, 17 April 2015

[MS_AccessPros] Re: print page n of n in access report

 

Sarah


I haven't used this, but it looks like it should work.

' This code was originally written by James H Brooks.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' James H Brooks
'
'Note: the line Me!Salesperson should be changed to the control name
'of the group you wish to track pages for.
'Me!ctlGrpPages is the name of a control you should place in the page
'footer. You can also change this line to whatever form you wish your
'page numbers to take.

Option Compare Database
Option Explicit

Dim GrpArrayPage(), GrpArrayPages()
Dim GrpNameCurrent As Variant, GrpNamePrevious As Variant
Dim GrpPage As Integer, GrpPages As Integer


Private Sub PageFooter_Format(Cancel As Integer, FormatCount As Integer)
Dim i As Integer
  If Me.Pages = 0 Then
    ReDim Preserve GrpArrayPage(Me.Page + 1)
    ReDim Preserve GrpArrayPages(Me.Page + 1)
    GrpNameCurrent = Me!Salesperson
    If GrpNameCurrent = GrpNamePrevious Then
        GrpArrayPage(Me.Page) = GrpArrayPage(Me.Page - 1) + 1
        GrpPages = GrpArrayPage(Me.Page)
            For i = Me.Page - ((GrpPages) - 1) To Me.Page
                GrpArrayPages(i) = GrpPages
            Next i
    Else
        GrpPage = 1
        GrpArrayPage(Me.Page) = GrpPage
        GrpArrayPages(Me.Page) = GrpPage
    End If
  Else
    Me!ctlGrpPages = "Group Page " & GrpArrayPage(Me.Page) & " of " & GrpArrayPages(Me.Page)
  End If
  GrpNamePrevious = GrpNameCurrent
End Sub


Regards,
Bill Mosca, Founder - MS_Access_Professionals
http://www.thatlldoit.com
Microsoft Office Access MVP
http://mvp.microsoft.com/en-us/mvp/Bill%20Mosca-35852
My nothing-to-do-with-Access blog
http://wrmosca.wordpress.com



---In MS_Access_Professionals@yahoogroups.com, <sarahk@schemesoftware.com> wrote :

Is there any way to print 'page n of n' based on a sub-group of an access report, instead of based on the complete report?.

for example: I am printing report cards for an entire class , sorted and grouped by name. A report card can span multiple pages, is there a way to print 'page n of n' in the footer for the individual report card. So that a student would get page 1 of 2 and 2 of 2 on their report card?.


I tried to insert a textbox in the name footer ="Page " & [Page] & " of " & [Pages], but the report does not run at all, just say 'formatting' ,but it is 'frozen'.


Is there any way I can do this, so that I dont have to print each report card individually.


Sarah

 

__._,_.___

Posted by: wrmosca@comcast.net
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)

.

__,_._,___

Tidak ada komentar:

Posting Komentar