Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Pennsylvania, USA
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VB Code (97 / SR2b)

    Could someone advise me as to what I did wrong in the code that follows.

    I've made a report that prints a customer statement of account., One or more pages per customer. Where there is only one page an unbound control in the page footer should read "1 of 1". And if there are more then one page, maybe 2 pages then the control should read on page 1 "1 of 2" and on page 2 "2 of 2".
    I have placed this code in the PageFooter Proporty OnFormat. I must have typed something incorrectly as the code does not work .
    Thank you for your time



    Private Sub PageFooter1_Format(Cancel As Integer, FormatCount As Integer)

    Dim GrpArrayPage(), GrpArrayPages()
    Dim GrpNameCurrent As Variant, GrpNamePrevious As Variant
    Dim GrpPage As Integer, GrpPages 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!CustCode
    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!txtGrpPages = "Group Page" & GrpArrayPage(Me.Page) & " of " & GrpArrayPages(Me.Page)
    End If
    GrpNamePrevious = GrpNameCurrent


    End Sub
    threecrow

    Don't make excuses. It's what you do, not why you didn't.

  2. #2
    dave_hill
    Guest

    Re: VB Code (97 / SR2b)

    In the control source of a text box in the page footer you can enter
    = [Page] & " of " & [Pages]
    and get what you're looking for.

  3. #3
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Pennsylvania, USA
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VB Code (97 / SR2b)

    Dave Thanks Kindly for the reply

    Your answer is a very good one. But sadly it is not my solution.

    My customer statements are printed in mass. One statement to a customer. I may have 36 statements and have 54 pages printed.
    Customer number one may only have one page.
    Customer number two may have two pages.
    My grouping is done on the customer.

    thank you once again
    threecrow

    Don't make excuses. It's what you do, not why you didn't.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •