[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

resetting page n of M in report

Posted on 2008-02-01
14
Medium Priority
?
467 Views
Last Modified: 2012-06-27
I am trying to reset the page numbers on a report each time the name changes.
I have searched the knowledge base and found the following link
http://www.mvps.org/access/reports/rpt0013.htm
but, being a novice, I have not been able to figure out how to use it.
I could use some patience and detailed explanation on how to make this work.
This is the following code I am trying to use:

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!GroupHeader0
    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

I am not real sure where to put what ?????  I tried to find an example db using this but was unsuccessful
0
Comment
Question by:ssblue
  • 7
  • 5
  • 2
14 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 1000 total points
ID: 20797435
this is simpler

How to reset the page number on a group level in an Access report

http://support.microsoft.com/kb/209215/

http://support.microsoft.com/default.aspx?scid=kb;en-us;841779
0
 
LVL 59
ID: 20797555
<<I am not real sure where to put what ?????  >>

  The second MSKB article cap posted will give you the step by step.  The difference between the two is that the first only gives you a page number (x) and the second gives you the page number over the group (x of y).

 in the code you picked up, which uses the same technique as the MSKB article basically.  The code gets pasted into the reports module.  It goes here:

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

  the page footer.  The code is assuming that your page control is called ctlGrpPages.

HTH,
JimD
0
 
LVL 59

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 1000 total points
ID: 20797575
Note that one major difference between what cap posted and the code you picked up is that the latter uses an array instead of a table to store the page for each group.  it's also a little tighter code wise with everything on one procedure.

JimD
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 

Author Comment

by:ssblue
ID: 20798440
I had seen the microsoft examples but didn't really want to use them -- but I could.
I really would like to figure out the array.  I have text box in the page footer that is called ctlGrpPages but it still doesn't want  to work??  
I want to re number on my Exr1Header which is called GroupHeader0
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 20798496
ssblue,

if you really want to use the array..

zip your db and upload here www.ee-stuff.com

0
 

Author Comment

by:ssblue
ID: 20798641
0
 

Author Comment

by:ssblue
ID: 20798651
The report we are looking at is

Individ_All_CrossTabRpt
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 20799459
ok,  at first look

place the codes in  

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


end sub


change

GrpNameCurrent = Me!GroupHeader0

to

GrpNameCurrent = Me.Expr1
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 20799482
also change

CtlGrpPage

to

CtlGrpPages

and remove the control source  ="Page " & [Page] & " of " & [Pages]
0
 

Author Comment

by:ssblue
ID: 20799681
Did that but now it is like one report pages 1 of 65 and I lost my groupings??
0
 

Author Comment

by:ssblue
ID: 20800204
Still not working right????
0
 

Author Comment

by:ssblue
ID: 20814912
Well that is working, however, on a 3 page group it is showing
Group page 1 of 1
Group page 2 of 2
Group page 3 of 3
instead of
Group page 1 of 3
Group page 2 of 3
Group page 3 of 3
0
 

Author Comment

by:ssblue
ID: 20894691
Thanks for the help -- even though we didn't get there.  I have something that will work and now I know and understand more.  Thanks again!
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

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

I have had my own IT business for a very long time. I started mostly with hardware and after about a year started to notice a common theme. I had shelves with software boxes -- Peachtree, Quicken, Sage, Ouickbooks -- and yet most of my clients were…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

590 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