Report page number resetting

S

Silvio

Hello everyone, I have a report that that will start a new page for each
Group in my report. Each group in this report represents a customer and its
activities. The page footer has the control to display the page number
sequentially. How can I force Access 2007 to start with page 1 (one) for each
customer? Some customer has enough data to fill more than one page and in
that case that customer report will have page 1 and page 2 then when the next
customer is printed the first page for that customer will be page 1 again and
so on. I know that sunning “individual†reports it will give me what I want I
would like to print all my data from a single report.
Thank you,
Silvio
 
M

Marshall Barton

Silvio said:
Hello everyone, I have a report that that will start a new page for each
Group in my report. Each group in this report represents a customer and its
activities. The page footer has the control to display the page number
sequentially. How can I force Access 2007 to start with page 1 (one) for each
customer? Some customer has enough data to fill more than one page and in
that case that customer report will have page 1 and page 2 then when the next
customer is printed the first page for that customer will be page 1 again and
so on. I know that sunning “individual” reports it will give me what I want I
would like to print all my data from a single report.


Just add a line of code to the group header section's Format
or Print event procedure:
Me.Page = 1
 
S

Silvio

Hi Marshall, I am trying to use the code from
http://www.mvps.org/access/reports/rpt0013.htm

so I can get Page # of ## However, the code does not work for me for some
reason. I am trying to use it in Access 2007.

My report is set as follow:

Group on: Customer
Then the property of the Customer Header are:
Force New Page: Before Section
Repeat Section: Yes

Then the Page Footer has a control named ctlGrpPages and the Control Source
is:
="Page " & [Page] & " of " & [Pages]


The page Footer has the following event On Format:

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.Customer
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 = "Page " & GrpArrayPage(Me.Page) & " of " &
GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent

End Sub

The line I am getting stuck with is: Me.ctlGrpPages = "Page " &
GrpArrayPage(Me.Page) & " of " & GrpArrayPages(Me.Page)

The message I am getting is Run-time error '-2147352567 (800200009)': You
can't assign a value to this object.

Any idea how to fic this?
 
M

Marshall Barton

Silvio said:
Hi Marshall, I am trying to use the code from
http://www.mvps.org/access/reports/rpt0013.htm

so I can get Page # of ## However, the code does not work for me for some
reason. I am trying to use it in Access 2007.

My report is set as follow:

Group on: Customer
Then the property of the Customer Header are:
Force New Page: Before Section
Repeat Section: Yes

Then the Page Footer has a control named ctlGrpPages and the Control Source
is:
="Page " & [Page] & " of " & [Pages]


The page Footer has the following event On Format:

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.Customer
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 = "Page " & GrpArrayPage(Me.Page) & " of " &
GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent

End Sub

The line I am getting stuck with is: Me.ctlGrpPages = "Page " &
GrpArrayPage(Me.Page) & " of " & GrpArrayPages(Me.Page)

The message I am getting is Run-time error '-2147352567 (800200009)': You
can't assign a value to this object.


You can not set its value because the text box has an
expression that calculates its value. Remove the expression
in the text box's control source and then I think it might
work,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top