Group page numbering

L

Leslie Isaacs

Hello All

I have a report with group [staffname] header and footer, and have forced a
new page after each [staffname] footer section. I need to print the page
number for each page within a group - starting from 1 on the first page of
each group. So, if the first group has 3 pages, and the second group has 4
pages and the third group has 2 pages, the page numbering of the report
needs to be 1,2,3,1,2,3,4,1,2.

I'm sure this can be done but I can't see how - hope someone can help.

Many thanks
Leslie Isaacs
 
C

Cheryl Fischer

Leslie,

There is code here that will number pages within a report grouping.

http://www.mvps.org/access/reports/rpt0013.htm

The key to making this work is:

Have TWO textbox controls in the PageFooter of the report

a. One textbox named: ctlGrpPages No other properties set

b. One textbox named: <any other name you wish>

ControlSource property set to: =[Pages] Visible set to 'No'


hth,
 
L

Leslie Isaacs

Hello Cheryl

Thanks for your reply.

I must be a bit thick, because I can't get the code to work!

I did as you said with the two text boxes in the PageFooter section, but
when the notes at http://www.mvps.org/access/reports/rpt0013.htm say "Open
any report in design view and open its Code-Behind-Reports module.", I
wasn't sure what this means, but I pasted the code into the form's On Open
event: is this right? I noticed that the code includes the line:

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

Does this mean the code should be pasted as the PageFooter On Format event
procedure?
When I tried to do this, the procedure came up with the line:

Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As
Integer)
which is not quite the same as above.

You can see I'm getting a bit lost here!
Possibly the problem is connected to the fact that the name of my 'group' is
[actualjobdesc stafname]. As per the instruction I changed the line

GrpNameCurrent = Me!Salesperson
to
GrpNameCurrent = Me!actualjobdesc stafname
then to
GrpNameCurrent = [Me]![actualjobdesc stafname]
then to
GrpNameCurrent = Me!actualjobdescstafname
(having changed the field anme to [actualjobdescstafname] in the report's
underlying query)

None of these worked!
Where have I gone wrong?

Thanks for your continued help.
Les


Cheryl Fischer said:
Leslie,

There is code here that will number pages within a report grouping.

http://www.mvps.org/access/reports/rpt0013.htm

The key to making this work is:

Have TWO textbox controls in the PageFooter of the report

a. One textbox named: ctlGrpPages No other properties set

b. One textbox named: <any other name you wish>

ControlSource property set to: =[Pages] Visible set to 'No'


hth,
--

Cheryl Fischer, MVP Microsoft Access



Leslie Isaacs said:
Hello All

I have a report with group [staffname] header and footer, and have
forced
a
new page after each [staffname] footer section. I need to print the page
number for each page within a group - starting from 1 on the first page of
each group. So, if the first group has 3 pages, and the second group has 4
pages and the third group has 2 pages, the page numbering of the report
needs to be 1,2,3,1,2,3,4,1,2.

I'm sure this can be done but I can't see how - hope someone can help.

Many thanks
Leslie Isaacs
 
C

Cheryl Fischer

Leslie,
wasn't sure what this means, but I pasted the code into the form's On Open
event: is this right?

No, the code should not be put into the Open event of the report.

The following line is correct and, yes, the code goes into the Page Footer's
"On Format" event.

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

The Private Sub .... header found in the code is likely related to the
version for which it was originally written - use what your version of
Access uses.

As to your group names, the following is probably a good idea.
GrpNameCurrent = Me!actualjobdescstafname
(having changed the field anme to [actualjobdescstafname] in the report's
underlying query)

Now, when you say nothing works, that doesn't provide much to go on. Are
you receiving an error message? If so, what is it and what line in the code
produces it?

Is there any *other* code behind the report which you were using in an
attempt to paginate by groups? If so, comment it out.

--

Cheryl Fischer, MVP Microsoft Access



Leslie Isaacs said:
Hello Cheryl

Thanks for your reply.

I must be a bit thick, because I can't get the code to work!

I did as you said with the two text boxes in the PageFooter section, but
when the notes at http://www.mvps.org/access/reports/rpt0013.htm say "Open
any report in design view and open its Code-Behind-Reports module.", I
wasn't sure what this means, but I pasted the code into the form's On Open
event: is this right? I noticed that the code includes the line:

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

Does this mean the code should be pasted as the PageFooter On Format event
procedure?
When I tried to do this, the procedure came up with the line:

Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As
Integer)
which is not quite the same as above.

You can see I'm getting a bit lost here!
Possibly the problem is connected to the fact that the name of my 'group' is
[actualjobdesc stafname]. As per the instruction I changed the line

GrpNameCurrent = Me!Salesperson
to
GrpNameCurrent = Me!actualjobdesc stafname
then to
GrpNameCurrent = [Me]![actualjobdesc stafname]
then to
GrpNameCurrent = Me!actualjobdescstafname
(having changed the field anme to [actualjobdescstafname] in the report's
underlying query)

None of these worked!
Where have I gone wrong?

Thanks for your continued help.
Les


Cheryl Fischer said:
Leslie,

There is code here that will number pages within a report grouping.

http://www.mvps.org/access/reports/rpt0013.htm

The key to making this work is:

Have TWO textbox controls in the PageFooter of the report

a. One textbox named: ctlGrpPages No other properties set

b. One textbox named: <any other name you wish>

ControlSource property set to: =[Pages] Visible set to 'No'


hth,
--

Cheryl Fischer, MVP Microsoft Access



Leslie Isaacs said:
Hello All

I have a report with group [staffname] header and footer, and have
forced
a
new page after each [staffname] footer section. I need to print the page
number for each page within a group - starting from 1 on the first
page
has
 
B

Bruce

I could not get the code to work either, so I went back to
searching newsgroups, where I found this thread. I had
just opened a code window and pasted the code, and it fell
in place as it should, with the code being in two
sections. The second section started with Private Sub
PageFooter_Format...etc. The problem was that it needed
to be Private Sub PageFooterSection_Format...etc. The
other point is that the supplied code seems to be based on
the assumption that the report is grouped by Salesperson,
and that there is a control (text box) named Salesperson
in the group header (or footer). In my case my report
(which is based on a query) is grouped by FullName. The
text box containing that field is txtFullName. At first I
was using Me!FullName in place of Me!Salesperson. As soon
as I changed it to Me!txtFullName, and changed PageFooter
to PageFooterSection as described above, it worked. Your
exchange on this subject was very timely.
-----Original Message-----
Leslie,
wasn't sure what this means, but I pasted the code into the form's On Open
event: is this right?

No, the code should not be put into the Open event of the report.

The following line is correct and, yes, the code goes into the Page Footer's
"On Format" event.

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

The Private Sub .... header found in the code is likely related to the
version for which it was originally written - use what your version of
Access uses.

As to your group names, the following is probably a good idea.
GrpNameCurrent = Me!actualjobdescstafname
(having changed the field anme to
[actualjobdescstafname] in the
report's
underlying query)

Now, when you say nothing works, that doesn't provide much to go on. Are
you receiving an error message? If so, what is it and what line in the code
produces it?

Is there any *other* code behind the report which you were using in an
attempt to paginate by groups? If so, comment it out.

--

Cheryl Fischer, MVP Microsoft Access



Hello Cheryl

Thanks for your reply.

I must be a bit thick, because I can't get the code to work!

I did as you said with the two text boxes in the PageFooter section, but
when the notes at http://www.mvps.org/access/reports/rpt0013.htm say "Open
any report in design view and open its Code-Behind- Reports module.", I
wasn't sure what this means, but I pasted the code into the form's On Open
event: is this right? I noticed that the code includes the line:

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

Does this mean the code should be pasted as the PageFooter On Format event
procedure?
When I tried to do this, the procedure came up with the line:

Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As
Integer)
which is not quite the same as above.

You can see I'm getting a bit lost here!
Possibly the problem is connected to the fact that the
name of my 'group'
is
[actualjobdesc stafname]. As per the instruction I changed the line

GrpNameCurrent = Me!Salesperson
to
GrpNameCurrent = Me!actualjobdesc stafname
then to
GrpNameCurrent = [Me]![actualjobdesc stafname]
then to
GrpNameCurrent = Me!actualjobdescstafname
(having changed the field anme to [actualjobdescstafname] in the report's
underlying query)

None of these worked!
Where have I gone wrong?

Thanks for your continued help.
Les


Leslie,

There is code here that will number pages within a report grouping.

http://www.mvps.org/access/reports/rpt0013.htm

The key to making this work is:

Have TWO textbox controls in the PageFooter of the report

a. One textbox named: ctlGrpPages No other properties set

b. One textbox named: <any other name you wish>

ControlSource property set to: =
[Pages] Visible set to
'No'
hth,
--

Cheryl Fischer, MVP Microsoft Access



Hello All

I have a report with group [staffname] header and
footer, and have
forced
a
new page after each [staffname] footer section. I
need to print the
page 1 on the first
page
the second group
has
numbering of the
report

.
 

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