Can I manually reset page numbers?

S

sjkrause

I have a report that prints several pages of information for each record. I
would like to have a "Page 1 of 6" footer at the bottom of each page, but I
want the page number to reset itself to 1 with each new record, and have the
"pages" number equal the number of pages for that particular record, not the
total number of pages in the entire report. Is there a way to do this?

Thanks
 
F

fredg

I have a report that prints several pages of information for each record. I
would like to have a "Page 1 of 6" footer at the bottom of each page, but I
want the page number to reset itself to 1 with each new record, and have the
"pages" number equal the number of pages for that particular record, not the
total number of pages in the entire report. Is there a way to do this?

Thanks

Group the report on the RecordID field.
Then follow the instructions here:

"Printing First and Last Page Numbers for Report Groups "
http://www.mvps.org/access/reports/rpt0013.htm
 
S

sjkrause

Thanks for the help. Your suggestion seems to be what I need. However, I
cannot figure out how to add Me!ctlGrpPages to the page footer. I've tried
entering it as a text box, but when I run the report, Access keeps asking me
to input the value of Me!ctlGrpPages. Can you suggest what I should be doing
instead?
 
F

fredg

Thanks for the help. Your suggestion seems to be what I need. However, I
cannot figure out how to add Me!ctlGrpPages to the page footer. I've tried
entering it as a text box, but when I run the report, Access keeps asking me
to input the value of Me!ctlGrpPages. Can you suggest what I should be doing
instead?

That is an error in the instructions.
The NAME of the unbound control should be

ctlGrpPages

not Me!ctlGrpPages
 
S

sjkrause

fredg said:
That is an error in the instructions.
The NAME of the unbound control should be

ctlGrpPages

not Me!ctlGrpPages
Thank you. I created an unbound text box in the footer, and named it
ctlGrpPages. Access no longer prompts me for a value, but it does not print
anything in the footer.

sjkrause
 
F

fredg

** snipped **
Thank you. I created an unbound text box in the footer, and named it
ctlGrpPages. Access no longer prompts me for a value, but it does not print
anything in the footer.

sjkrause

From the instructions:
*** Note: the line Me!Salesperson should be changed to the control
name of the group you wish to track pages for.

Did you, in addition to adding the ctlGrpPages control to the page
footer, change the the code as instructed, from
GrpNameCurrent = Me!Salesman to
GrpNameCurrent = Me!RecordID
or whatever the name of the field is you are grouping on?
 
S

sjkrause

Yes, I changed the Me!Salesperson text to the name of the actual RecordID
field. I went so far as to copy the recommended code directly into a new
database with a "Salesperson" field, just to see if I could make it work. It
still didn't.

I am quite new at VBA. I copied the code you sent, opened my report in
design view, clicked on the upper left properties box, opened the "code
builder" option, then pasted the VBA code there. Then I changed the
"salesperson" text as instructed. Have I placed the code incorrectly, or
made some other error which a more experienced person would consider obvious?

Thanks once again for your help.

sjkrause
 
F

fredg

Yes, I changed the Me!Salesperson text to the name of the actual RecordID
field. I went so far as to copy the recommended code directly into a new
database with a "Salesperson" field, just to see if I could make it work. It
still didn't.

I am quite new at VBA. I copied the code you sent, opened my report in
design view, clicked on the upper left properties box, opened the "code
builder" option, then pasted the VBA code there. Then I changed the
"salesperson" text as instructed. Have I placed the code incorrectly, or
made some other error which a more experienced person would consider obvious?

Thanks once again for your help.

sjkrause

Let's make it easy.
I can't see what you have, so if you wish, you can send me the Db.
If you do, only send the table/query and whatever else is needed just
for this report. Strip out everything else.

Send it to
(e-mail address removed)
Make sure you write just
GroupPages
as the subject, as I normally delete everything in this email address
without reading.
 
S

sjkrause

Thank you. I just sent you a very stripped down version of the file, and its
..mdw file as well.

sjkrause
 
F

fredg

Thank you. I just sent you a very stripped down version of the file, and its
.mdw file as well.

sjkrause
I sent you a duplicate copy of this via reply to sender.
Just in case you didn't see it, as well as for others who may have
been following this thread, here is what you need to do.

1) In Design View, add a control to the page footer
Set it's control source to:
=[Pages]
You can make this control not visible if you wish.
This added control (=[Pages]) forces Access to format the report
twice; once to count pages, then to actually preview or print.

2) Open the report's code window.
Find the Private Sub PageFooter_Format(Cancel As Integer, FormatCount
As Integer)
code that you pasted in.
Select everything between that line and it's End Sub line.
Cut it.
Delete the Private Sub PageFooter_Format(Cancel As Integer,
FormatCount As Integer) line and the End Sub line.

This code was written to the code window, but [Event Procedure] was
not written on the Format line, so the code was never run!

Exit the code window.

3) Click on the Page Footer Property sheet's Event tab.
In the Format event line, write:
[Event Procedure]
Click on the button with the 3 dots that appears on that line.
When the Page FooterSection code window opens paste the previously cut
code into this new PageFooterSection_Format event between the 2
already existing lines.
Exit the code window.

4) Note: You can also shorten the detail section height to just under
the Sub Report control, as the Sub Report control will grow.

5) Run the report.
 
S

sjkrause

fredg said:
Thank you. I just sent you a very stripped down version of the file, and its
.mdw file as well.

sjkrause
I sent you a duplicate copy of this via reply to sender.
Just in case you didn't see it, as well as for others who may have
been following this thread, here is what you need to do.

1) In Design View, add a control to the page footer
Set it's control source to:
=[Pages]
You can make this control not visible if you wish.
This added control (=[Pages]) forces Access to format the report
twice; once to count pages, then to actually preview or print.

2) Open the report's code window.
Find the Private Sub PageFooter_Format(Cancel As Integer, FormatCount
As Integer)
code that you pasted in.
Select everything between that line and it's End Sub line.
Cut it.
Delete the Private Sub PageFooter_Format(Cancel As Integer,
FormatCount As Integer) line and the End Sub line.

This code was written to the code window, but [Event Procedure] was
not written on the Format line, so the code was never run!

Exit the code window.

3) Click on the Page Footer Property sheet's Event tab.
In the Format event line, write:
[Event Procedure]
Click on the button with the 3 dots that appears on that line.
When the Page FooterSection code window opens paste the previously cut
code into this new PageFooterSection_Format event between the 2
already existing lines.
Exit the code window.

4) Note: You can also shorten the detail section height to just under
the Sub Report control, as the Sub Report control will grow.

5) Run the report.

Thank you very much. Your suggestions worked, and the report now runs just
as intended.

sjkrause
 
G

Greg

I was just looking at this post and am looking to perform the same function.
I copied in the code and performed all the necessary steps. The only thing is
that my report is not giving me the desired results. It "almost" works. What
happens is this: I have three groups. Group 1 has 1 page, Group 2 has 1 page
and Group 3 has 4 Pages. What's happening in my case is Group 1 shows Page 1
of 4, Group 2 show Page 1 of 4 and Group 3 works just fine for all 4 pages. I
can't quite see what it is that I am missing.

sjkrause said:
fredg said:
Thank you. I just sent you a very stripped down version of the file, and its
.mdw file as well.

sjkrause

:

On Fri, 17 Jun 2005 11:08:02 -0700, sjkrause wrote:

Yes, I changed the Me!Salesperson text to the name of the actual RecordID
field. I went so far as to copy the recommended code directly into a new
database with a "Salesperson" field, just to see if I could make it work. It
still didn't.

I am quite new at VBA. I copied the code you sent, opened my report in
design view, clicked on the upper left properties box, opened the "code
builder" option, then pasted the VBA code there. Then I changed the
"salesperson" text as instructed. Have I placed the code incorrectly, or
made some other error which a more experienced person would consider obvious?

Thanks once again for your help.

sjkrause

:

** snipped **

Thank you. I created an unbound text box in the footer, and named it
ctlGrpPages. Access no longer prompts me for a value, but it does not print
anything in the footer.

sjkrause

From the instructions:
*** Note: the line Me!Salesperson should be changed to the control
name of the group you wish to track pages for.

Did you, in addition to adding the ctlGrpPages control to the page
footer, change the the code as instructed, from
GrpNameCurrent = Me!Salesman to
GrpNameCurrent = Me!RecordID
or whatever the name of the field is you are grouping on?

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.


Let's make it easy.
I can't see what you have, so if you wish, you can send me the Db.
If you do, only send the table/query and whatever else is needed just
for this report. Strip out everything else.

Send it to
(e-mail address removed)
Make sure you write just
GroupPages
as the subject, as I normally delete everything in this email address
without reading.
I sent you a duplicate copy of this via reply to sender.
Just in case you didn't see it, as well as for others who may have
been following this thread, here is what you need to do.

1) In Design View, add a control to the page footer
Set it's control source to:
=[Pages]
You can make this control not visible if you wish.
This added control (=[Pages]) forces Access to format the report
twice; once to count pages, then to actually preview or print.

2) Open the report's code window.
Find the Private Sub PageFooter_Format(Cancel As Integer, FormatCount
As Integer)
code that you pasted in.
Select everything between that line and it's End Sub line.
Cut it.
Delete the Private Sub PageFooter_Format(Cancel As Integer,
FormatCount As Integer) line and the End Sub line.

This code was written to the code window, but [Event Procedure] was
not written on the Format line, so the code was never run!

Exit the code window.

3) Click on the Page Footer Property sheet's Event tab.
In the Format event line, write:
[Event Procedure]
Click on the button with the 3 dots that appears on that line.
When the Page FooterSection code window opens paste the previously cut
code into this new PageFooterSection_Format event between the 2
already existing lines.
Exit the code window.

4) Note: You can also shorten the detail section height to just under
the Sub Report control, as the Sub Report control will grow.

5) Run the report.

Thank you very much. Your suggestions worked, and the report now runs just
as intended.

sjkrause
 
G

Greg

There's no need to reply. I figured out why the code was not working in my
report. There was a command in the GroupHeader_Format section that was
setting Me!Pages = 1, which resulted in my report always reporting the
incorrect results. My mistake for not noticing sooner.

Greg said:
I was just looking at this post and am looking to perform the same function.
I copied in the code and performed all the necessary steps. The only thing is
that my report is not giving me the desired results. It "almost" works. What
happens is this: I have three groups. Group 1 has 1 page, Group 2 has 1 page
and Group 3 has 4 Pages. What's happening in my case is Group 1 shows Page 1
of 4, Group 2 show Page 1 of 4 and Group 3 works just fine for all 4 pages. I
can't quite see what it is that I am missing.

sjkrause said:
fredg said:
On Fri, 17 Jun 2005 15:21:03 -0700, sjkrause wrote:

Thank you. I just sent you a very stripped down version of the file, and its
.mdw file as well.

sjkrause

:

On Fri, 17 Jun 2005 11:08:02 -0700, sjkrause wrote:

Yes, I changed the Me!Salesperson text to the name of the actual RecordID
field. I went so far as to copy the recommended code directly into a new
database with a "Salesperson" field, just to see if I could make it work. It
still didn't.

I am quite new at VBA. I copied the code you sent, opened my report in
design view, clicked on the upper left properties box, opened the "code
builder" option, then pasted the VBA code there. Then I changed the
"salesperson" text as instructed. Have I placed the code incorrectly, or
made some other error which a more experienced person would consider obvious?

Thanks once again for your help.

sjkrause

:

** snipped **

Thank you. I created an unbound text box in the footer, and named it
ctlGrpPages. Access no longer prompts me for a value, but it does not print
anything in the footer.

sjkrause

From the instructions:
*** Note: the line Me!Salesperson should be changed to the control
name of the group you wish to track pages for.

Did you, in addition to adding the ctlGrpPages control to the page
footer, change the the code as instructed, from
GrpNameCurrent = Me!Salesman to
GrpNameCurrent = Me!RecordID
or whatever the name of the field is you are grouping on?

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.


Let's make it easy.
I can't see what you have, so if you wish, you can send me the Db.
If you do, only send the table/query and whatever else is needed just
for this report. Strip out everything else.

Send it to
(e-mail address removed)
Make sure you write just
GroupPages
as the subject, as I normally delete everything in this email address
without reading.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

I sent you a duplicate copy of this via reply to sender.
Just in case you didn't see it, as well as for others who may have
been following this thread, here is what you need to do.

1) In Design View, add a control to the page footer
Set it's control source to:
=[Pages]
You can make this control not visible if you wish.
This added control (=[Pages]) forces Access to format the report
twice; once to count pages, then to actually preview or print.

2) Open the report's code window.
Find the Private Sub PageFooter_Format(Cancel As Integer, FormatCount
As Integer)
code that you pasted in.
Select everything between that line and it's End Sub line.
Cut it.
Delete the Private Sub PageFooter_Format(Cancel As Integer,
FormatCount As Integer) line and the End Sub line.

This code was written to the code window, but [Event Procedure] was
not written on the Format line, so the code was never run!

Exit the code window.

3) Click on the Page Footer Property sheet's Event tab.
In the Format event line, write:
[Event Procedure]
Click on the button with the 3 dots that appears on that line.
When the Page FooterSection code window opens paste the previously cut
code into this new PageFooterSection_Format event between the 2
already existing lines.
Exit the code window.

4) Note: You can also shorten the detail section height to just under
the Sub Report control, as the Sub Report control will grow.

5) Run the report.

Thank you very much. Your suggestions worked, and the report now runs just
as intended.

sjkrause
 
A

AccessFitz

Fred,

When I put the ctlgrpPages text box in the Page Footer, a green line appears
in the top left hand corner. It is an error indicator. I've followed your
instructions, but still no luck. Am I missing a reference or some line of
code?

Thanks
AccessFitz

1) In Design View, add a control to the page footer
Set it's control source to:
=[Pages]
You can make this control not visible if you wish.
This added control (=[Pages]) forces Access to format the report
twice; once to count pages, then to actually preview or print.

2) Open the report's code window.
Find the Private Sub PageFooter_Format(Cancel As Integer, FormatCount
As Integer)
code that you pasted in.
Select everything between that line and it's End Sub line.
Cut it.
Delete the Private Sub PageFooter_Format(Cancel As Integer,
FormatCount As Integer) line and the End Sub line.

This code was written to the code window, but [Event Procedure] was
not written on the Format line, so the code was never run!

Exit the code window.

3) Click on the Page Footer Property sheet's Event tab.
In the Format event line, write:
[Event Procedure]
Click on the button with the 3 dots that appears on that line.
When the Page FooterSection code window opens paste the previously cut
code into this new PageFooterSection_Format event between the 2
already existing lines.
Exit the code window.

4) Note: You can also shorten the detail section height to just under
the Sub Report control, as the Sub Report control will grow.

5) Run the report.
 
E

Eric_G

I have followed each of the steps to the letter, and still am experiencing a
problem. The program prompts me to enter a value for "ctlGrpPages". I'm
running Access 2000. I've added the control box "=[pages]" and have ensured
that the "Event Procedure" is running with the Page footer. I'm lost.....
 

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