Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I set page number by group??? 4

Status
Not open for further replies.

jlitondo

MIS
Jun 27, 2000
175
US
I have a report that is grouped by customer, that is, it prints several customers with their specific contract information.I have each new customer begin on a fresh page but the contract info can spill over to several pages.How do I reset the page numbers for each customer grouping?Any pointers will be appreciated.
 
It is definitely doable, but it is a bit tricky.&nbsp;&nbsp;The MS Knowledge Base has a very good article (#104760) on it.&nbsp;&nbsp;Here's a link.<br><br><A HREF=" TARGET="_new"> I don't have time to walk you through it, but please let us know if you need clarification.<br><br>Kathryn
 
Maybe I'm misunderstanding the problem.&nbsp;&nbsp;In the group footer, create a text box with the following control source&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&quot;Page &quot; & [Page] & &quot; of &quot; & [Pages]<br><br>It was a long time ago -- I think I may have used some kind of wizard for that code.&nbsp;&nbsp;I tested it and it appears to work.&nbsp;&nbsp;
 
Still having problem with the page numbers on my report.
 
Have you had a chance to look at the KB article?&nbsp;&nbsp;What problems are you having exactly? <p>Kathryn<br><a href=mailto: > </a><br><a href= > </a><br>
 
In the group header's OnFormat property, I reference a macro which has Page = 0. Then in the group footer's OnFormat property (Code), I set Page = 1. On running, the first page of the report is set to 1 then all the rest are set to 2.I'm still working on it but let me know if I'm missing something.
 
If you want the page number to be in the group footer, remove the reference to the macro resetting the page to 0 you put in the groupheader's OnFormat property.&nbsp;&nbsp;You can do only one or the other but not both.&nbsp;&nbsp;<br><br>
 
I've got the page numbers to reset each time a new group starts but how do I set the total number of pages of a group, such that if my report preview has 3 groups and 10 pages total, and 1 group has 4 pages, at the page footer for this group I show [Page 1 of 4] instead of [Page 1 of 10].Thanks.
 
I know what you mean.&nbsp;&nbsp;Before I wrote my last thread&nbsp;&nbsp;-- I tried to accomplish the very thing you are [1 of 4].&nbsp;&nbsp;It appears Microsoft left that part out of their HELP file. <br><br>Any programmers out there know how to address this?&nbsp;&nbsp;&nbsp;
 
I'm trying to see if I&nbsp;&nbsp;can set up some sort of variable to count the pages of each group. If I succeed, then I'll pass on the info.
 
Has anyone been successful at accomplishing this &quot;page x of x&quot;-within-a-group problem yet? I also need to do this.
 
Thank you for the response! I printed out the article and will have to wait to try it as I have been moved to other things to do at this time. I glanced at the web site and you are right, it looks to be a good resource!
 
I am sure that the answer to this question is very clear to everyone, but... i have a french version of Access 97 and when i went to the following address:

I was told to:
&quot;Open any report in design view and open its Code-Behind-Reports module&quot;

Could anyone show me the road to follow to &quot;open its Code-Behind-Reports module&quot;

I opened an existing report; open its properties and i am stuck there...

Thanks
 
At properties click the 'Event' tab. There will be a list of events that you can program using VB code.

Another way to get to the code is when in design view, click on your 'View' menu item and then click on the 'Code' option. This will display all of the code for the whole report. You can navigate to which object/event you want to see by using the two drop down boxes at the top of the screen.

Hope this helps.
 
Thanks for your help, but it still doesn't work...
Here is my code registered as a &quot;class module&quot;... &quot;General - PageFooter_Format&quot;

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 = Group1
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
PageNo = &quot;Group Page &quot; & GrpArrayPage(Me.Page) & &quot; of &quot; & GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent
End Sub

... and i have a control in my page footer named &quot;PageNo&quot; and where the source control goes like this: =[PageNo]

When i execute the report, it prints #error in my page footer

Thanks a lot for your help.
 
Hi, Has ANYONE cracked this one yet?

I'm having the same problem as Jlitondo and Aietoe. I can get the page no. to start at 1 for a new group but can't get the &quot;page X of Y&quot; thing figured out.

the article suggested by joe miller is giving me all sorts of error message, latest being &quot; Subscript out of range&quot;

Regards, X-)
ZAZA
 
In design view of your report:

1. In the PageFooter section, OnFormat event, click on the Code Builder button (...)

2. Copy & paste the code at the bottom of here. Like the instructions say:
Code:
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.

3. Place an unbound text box named ctlGrpPages in the Page footer.

Works like a charm......
 
cosmoKramer

When teh instructor says &quot;the line Me!Salesperson should be changed to the control name of the group you wish to track pages for&quot;, does he mean:

a) The name of the section in the report that starts on a new page when-ever the group changes. For my report that would be Me!Section(5) or Me!GoupHeader1. Either one gives an error saying that Access cannot find the field referred to.

b)the name of the field by which the Report is grouped? in this case it would me [personnel]as the report prints a list of reading material for each employee. When I do this I get an error message saying that the &quot;Script is oput of range&quot;



ZaZa

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top