Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Reset page number in a group

Discussion in 'Information Technology' started by Hwee, Jul 28, 2006.

  1. Hwee

    Hwee
    Expand Collapse
    Guest

    I tried the method stated below. However, the result came out as page 1 of 1
    and page 2 of 2 when there is two pages in the group. The result should be
    page 1 of 2 and page 2 of 2. Where did i go wrong? Pls help. Thank you =)

    "fredg" wrote:

    > On Mon, 5 Jun 2006 20:04:01 -0700, Hwee wrote:
    >
    > > Hi.. I have reset the page number for each group in a report. However, I am
    > > unable to calculate the total page number for each group.
    > > For example: For two groups, the first group got one page, second group got
    > > three pages. I want to set the page number to appear for first group: page
    > > 1/1. For second group: page 1/2 and page 2/2. Pls help. Thanks.

    >
    > See:
    > "Printing First and Last Page Numbers for Report Groups "
    > http://www.mvps.org/access/reports/rpt0013.htm
    >
    > Things to make sure of:
    > 1) Add a control to the page Footer that computes [Pages], i.e.
    > = [Pages]
    > You can make this control not visible if you wish.
    >
    > 2) Add an unbound control to the Page Footer.
    > Name this control "ctlGrpPages"
    >
    > 3) Paste the code into the Page Footer Format event.
    >
    > 4) In the code, change Me!Salesman to
    > Me![Name of the control used to group by]
    > --
    > Fred
    > Please respond only to this newsgroup.
    > I do not reply to personal e-mail
    >
     
  2. Loading...

    Similar Threads Forum Date
    World Israeli bedouins fight resettlement plan Breaking News Aug 3, 2013
    Leisure Arcade scores have been reset Business, Lifestyle & Leisure Oct 7, 2005
    Sikh News BJP holds protest against Resettlement Act GK NEWS SERVICE (Greater Kashmir) Breaking News Apr 30, 2005
    50 Or So Pages Of DG Are By Guru Gobind Singh Other Scriptures Sep 9, 2016
    Interfaith Nanak Is The Guru - Nanak Is The Lord Himself - Page 865, SGGS Interfaith Dialogues Sep 22, 2015

  3. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    I can assure you that sample code works, so without knowing what changes you
    made to it, I doubt anyone will be able to tell you where you went wrong.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Hwee" <Hwee@discussions.microsoft.com> wrote in message
    news:7AF0CC0D-ADD5-49DE-88F1-0C3BA34C2765@microsoft.com...
    > I tried the method stated below. However, the result came out as page 1 of

    1
    > and page 2 of 2 when there is two pages in the group. The result should be
    > page 1 of 2 and page 2 of 2. Where did i go wrong? Pls help. Thank you =)
    >
    > "fredg" wrote:
    > >
    > > See:
    > > "Printing First and Last Page Numbers for Report Groups "
    > > http://www.mvps.org/access/reports/rpt0013.htm
    > >
    > > Things to make sure of:
    > > 1) Add a control to the page Footer that computes [Pages], i.e.
    > > = [Pages]
    > > You can make this control not visible if you wish.
    > >
    > > 2) Add an unbound control to the Page Footer.
    > > Name this control "ctlGrpPages"
    > >
    > > 3) Paste the code into the Page Footer Format event.
    > >
    > > 4) In the code, change Me!Salesman to
    > > Me![Name of the control used to group by]
    > >
    > > > Hi.. I have reset the page number for each group in a report. However,

    I am
    > > > unable to calculate the total page number for each group.
    > > > For example: For two groups, the first group got one page, second

    group got
    > > > three pages. I want to set the page number to appear for first group:

    page
    > > > 1/1. For second group: page 1/2 and page 2/2. Pls help. Thanks.
     
  4. Hwee

    Hwee
    Expand Collapse
    Guest

    Thank you for replying. I didn't change the code. Because in my report, most
    sections only have one page. So it's fine to have page 1 of 1. However, for
    section with two or more pages, the total number of pages is wrong. The only
    thing i didn't follow is that i reset the page number for each section before
    writing the code. Should i change something to the GrpArrayPages?

    "Douglas J Steele" wrote:

    > I can assure you that sample code works, so without knowing what changes you
    > made to it, I doubt anyone will be able to tell you where you went wrong.
    >
    > --
    > Doug Steele, Microsoft Access MVP
    > http://I.Am/DougSteele
    > (no e-mails, please!)
    >
    >
    > "Hwee" <Hwee@discussions.microsoft.com> wrote in message
    > news:7AF0CC0D-ADD5-49DE-88F1-0C3BA34C2765@microsoft.com...
    > > I tried the method stated below. However, the result came out as page 1 of

    > 1
    > > and page 2 of 2 when there is two pages in the group. The result should be
    > > page 1 of 2 and page 2 of 2. Where did i go wrong? Pls help. Thank you =)
    > >
    > > "fredg" wrote:
    > > >
    > > > See:
    > > > "Printing First and Last Page Numbers for Report Groups "
    > > > http://www.mvps.org/access/reports/rpt0013.htm
    > > >
    > > > Things to make sure of:
    > > > 1) Add a control to the page Footer that computes [Pages], i.e.
    > > > = [Pages]
    > > > You can make this control not visible if you wish.
    > > >
    > > > 2) Add an unbound control to the Page Footer.
    > > > Name this control "ctlGrpPages"
    > > >
    > > > 3) Paste the code into the Page Footer Format event.
    > > >
    > > > 4) In the code, change Me!Salesman to
    > > > Me![Name of the control used to group by]
    > > >
    > > > > Hi.. I have reset the page number for each group in a report. However,

    > I am
    > > > > unable to calculate the total page number for each group.
    > > > > For example: For two groups, the first group got one page, second

    > group got
    > > > > three pages. I want to set the page number to appear for first group:

    > page
    > > > > 1/1. For second group: page 1/2 and page 2/2. Pls help. Thanks.

    >
    >
    >
     
  5. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    Did you follow all of the steps Fred layed out?

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Hwee" <Hwee@discussions.microsoft.com> wrote in message
    news:9B87A89D-127F-465B-9BC4-8C9D073B81AF@microsoft.com...
    > Thank you for replying. I didn't change the code. Because in my report,

    most
    > sections only have one page. So it's fine to have page 1 of 1. However,

    for
    > section with two or more pages, the total number of pages is wrong. The

    only
    > thing i didn't follow is that i reset the page number for each section

    before
    > writing the code. Should i change something to the GrpArrayPages?
    >
    > "Douglas J Steele" wrote:
    >
    > > I can assure you that sample code works, so without knowing what changes

    you
    > > made to it, I doubt anyone will be able to tell you where you went

    wrong.
    > >
    > > --
    > > Doug Steele, Microsoft Access MVP
    > > http://I.Am/DougSteele
    > > (no e-mails, please!)
    > >
    > >
    > > "Hwee" <Hwee@discussions.microsoft.com> wrote in message
    > > news:7AF0CC0D-ADD5-49DE-88F1-0C3BA34C2765@microsoft.com...
    > > > I tried the method stated below. However, the result came out as page

    1 of
    > > 1
    > > > and page 2 of 2 when there is two pages in the group. The result

    should be
    > > > page 1 of 2 and page 2 of 2. Where did i go wrong? Pls help. Thank you

    =)
    > > >
    > > > "fredg" wrote:
    > > > >
    > > > > See:
    > > > > "Printing First and Last Page Numbers for Report Groups "
    > > > > http://www.mvps.org/access/reports/rpt0013.htm
    > > > >
    > > > > Things to make sure of:
    > > > > 1) Add a control to the page Footer that computes [Pages], i.e.
    > > > > = [Pages]
    > > > > You can make this control not visible if you wish.
    > > > >
    > > > > 2) Add an unbound control to the Page Footer.
    > > > > Name this control "ctlGrpPages"
    > > > >
    > > > > 3) Paste the code into the Page Footer Format event.
    > > > >
    > > > > 4) In the code, change Me!Salesman to
    > > > > Me![Name of the control used to group by]
    > > > >
    > > > > > Hi.. I have reset the page number for each group in a report.

    However,
    > > I am
    > > > > > unable to calculate the total page number for each group.
    > > > > > For example: For two groups, the first group got one page, second

    > > group got
    > > > > > three pages. I want to set the page number to appear for first

    group:
    > > page
    > > > > > 1/1. For second group: page 1/2 and page 2/2. Pls help. Thanks.

    > >
    > >
    > >
     
  6. Hwee

    Hwee
    Expand Collapse
    Guest

    Yes. I write the code accordingly. Here is the code i wrote in microsoft
    visual basic.

    Option Compare Database
    Option Explicit
    Dim GrpArrayPage(), GrpArrayPages()
    Dim GrpNameCurrent As Variant, GrpNamePrevious As Variant
    Dim GrpPage As Integer, GrpPages As Integer


    Private Sub PageFooterSection_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!ctlGrpPages
    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

    Plus i created a textbox with control sourse =[Pages] and i make this not
    visible. Created another textbox named ctlGrpPages. The code is pasted.


    "Douglas J Steele" wrote:

    > Did you follow all of the steps Fred layed out?
    >
    > --
    > Doug Steele, Microsoft Access MVP
    > http://I.Am/DougSteele
    > (no e-mails, please!)
    >
    >
    > "Hwee" <Hwee@discussions.microsoft.com> wrote in message
    > news:9B87A89D-127F-465B-9BC4-8C9D073B81AF@microsoft.com...
    > > Thank you for replying. I didn't change the code. Because in my report,

    > most
    > > sections only have one page. So it's fine to have page 1 of 1. However,

    > for
    > > section with two or more pages, the total number of pages is wrong. The

    > only
    > > thing i didn't follow is that i reset the page number for each section

    > before
    > > writing the code. Should i change something to the GrpArrayPages?
    > >
    > > "Douglas J Steele" wrote:
    > >
    > > > I can assure you that sample code works, so without knowing what changes

    > you
    > > > made to it, I doubt anyone will be able to tell you where you went

    > wrong.
    > > >
    > > > --
    > > > Doug Steele, Microsoft Access MVP
    > > > http://I.Am/DougSteele
    > > > (no e-mails, please!)
    > > >
    > > >
    > > > "Hwee" <Hwee@discussions.microsoft.com> wrote in message
    > > > news:7AF0CC0D-ADD5-49DE-88F1-0C3BA34C2765@microsoft.com...
    > > > > I tried the method stated below. However, the result came out as page

    > 1 of
    > > > 1
    > > > > and page 2 of 2 when there is two pages in the group. The result

    > should be
    > > > > page 1 of 2 and page 2 of 2. Where did i go wrong? Pls help. Thank you

    > =)
    > > > >
    > > > > "fredg" wrote:
    > > > > >
    > > > > > See:
    > > > > > "Printing First and Last Page Numbers for Report Groups "
    > > > > > http://www.mvps.org/access/reports/rpt0013.htm
    > > > > >
    > > > > > Things to make sure of:
    > > > > > 1) Add a control to the page Footer that computes [Pages], i.e.
    > > > > > = [Pages]
    > > > > > You can make this control not visible if you wish.
    > > > > >
    > > > > > 2) Add an unbound control to the Page Footer.
    > > > > > Name this control "ctlGrpPages"
    > > > > >
    > > > > > 3) Paste the code into the Page Footer Format event.
    > > > > >
    > > > > > 4) In the code, change Me!Salesman to
    > > > > > Me![Name of the control used to group by]
    > > > > >
    > > > > > > Hi.. I have reset the page number for each group in a report.

    > However,
    > > > I am
    > > > > > > unable to calculate the total page number for each group.
    > > > > > > For example: For two groups, the first group got one page, second
    > > > group got
    > > > > > > three pages. I want to set the page number to appear for first

    > group:
    > > > page
    > > > > > > 1/1. For second group: page 1/2 and page 2/2. Pls help. Thanks.
    > > >
    > > >
    > > >

    >
    >
    >
     

Share This Page