Pages not numbering correctly

  • Thread starter diablowrym via AccessMonster.com
  • Start date
D

diablowrym via AccessMonster.com

I am using: ="Page: " & [Page] & " of " & [Pages]
in a text box on a report. When I run the report I will have only a 6 page
report, but this gives me : Page 1 of 11
or some other amount if the actual page count if different.
Any ideas why this might be happening?
Thanks.
 
M

Marshall Barton

diablowrym said:
I am using: ="Page: " & [Page] & " of " & [Pages]
in a text box on a report. When I run the report I will have only a 6 page
report, but this gives me : Page 1 of 11
or some other amount if the actual page count if different.


That usually happens when you try to make something
vidible/invisble based on the last page; For example, if
you have a subreport in a group footer section, but you do
not want to display it on the last page using code like:

Me.somecontrol.Visible = (Me.Page <> Me/Pages)

With the large discrepency you are seeing, whatever control
is being hidden must be fairly large (such as a subreport or
a text box with several paragraphs of text. Regardless of
what kind of control it is, check all the report sections'
Format event procedures for some code that references the
Pages property.
 
D

diablowrym via AccessMonster.com

The only things that are hidden on my report is:
Report Header - shows on first page only
Page Header - shows on all BUT the first page
Report Footer - none
Page Footer - first page only

Ther than these nothing is set to be hidden or not visible

Marshall said:
I am using: ="Page: " & [Page] & " of " & [Pages]
in a text box on a report. When I run the report I will have only a 6 page
report, but this gives me : Page 1 of 11
or some other amount if the actual page count if different.

That usually happens when you try to make something
vidible/invisble based on the last page; For example, if
you have a subreport in a group footer section, but you do
not want to display it on the last page using code like:

Me.somecontrol.Visible = (Me.Page <> Me/Pages)

With the large discrepency you are seeing, whatever control
is being hidden must be fairly large (such as a subreport or
a text box with several paragraphs of text. Regardless of
what kind of control it is, check all the report sections'
Format event procedures for some code that references the
Pages property.
 
M

Marshall Barton

Try using the Edit menu to find Pages in the current module.

I think there must be some code in the module that is
changing the size or visibility of something based on the
Pages (or maybe the Page??) property.

If you can not find anything like that and if the module is
less than a hundred lines, post back with a Copy/Paste of
the code.
--
Marsh
MVP [MS Access]

The only things that are hidden on my report is:
Report Header - shows on first page only
Page Header - shows on all BUT the first page
Report Footer - none
Page Footer - first page only

Ther than these nothing is set to be hidden or not visible

Marshall said:
I am using: ="Page: " & [Page] & " of " & [Pages]
in a text box on a report. When I run the report I will have only a 6 page
report, but this gives me : Page 1 of 11
or some other amount if the actual page count if different.

That usually happens when you try to make something
vidible/invisble based on the last page; For example, if
you have a subreport in a group footer section, but you do
not want to display it on the last page using code like:

Me.somecontrol.Visible = (Me.Page <> Me/Pages)

With the large discrepency you are seeing, whatever control
is being hidden must be fairly large (such as a subreport or
a text box with several paragraphs of text. Regardless of
what kind of control it is, check all the report sections'
Format event procedures for some code that references the
Pages property.
 
D

diablowrym via AccessMonster.com

I asked this question in another post. This code is working in my 2003
version but not the 2007. Both versions I'm getting the wrong page counts.

Private Sub PageFooterSection_Print(Cancel As Integer, PrintCount As Integer)

If [Page] = [Pages] Then
Me.PageFooterSection.Visible = True
Else
Me.PageFooterSection.Visible = False
End If

End Sub


Marshall said:
Try using the Edit menu to find Pages in the current module.

I think there must be some code in the module that is
changing the size or visibility of something based on the
Pages (or maybe the Page??) property.

If you can not find anything like that and if the module is
less than a hundred lines, post back with a Copy/Paste of
the code.
The only things that are hidden on my report is:
Report Header - shows on first page only
[quoted text clipped - 22 lines]
 
M

Marshall Barton

diablowrym said:
I asked this question in another post. This code is working in my 2003
version but not the 2007. Both versions I'm getting the wrong page counts.

Private Sub PageFooterSection_Print(Cancel As Integer, PrintCount As Integer)

If [Page] = [Pages] Then
Me.PageFooterSection.Visible = True
Else
Me.PageFooterSection.Visible = False
End If

End Sub


"Not working" is a singularly clue free statement. I
haven't played with A2007 enough to know the nuances of this
problem so I will only try to address the A2003 side of it.

First, when you use a text box with Pages, it causes Access
to process the report two times. The first time, it tries
to figure out how many pages are in the report so Pages can
have a value the next time through. Because the value of
Pages is not known the first time through, its value is 0
(zero). This means that your code always makes the page
footer invisible during the first pass (even on the "last"
page). When the page number gets to the calculated value of
Pages during the second pass, then the page footer will be
made visible. But the page footer being visible may(?) push
other stuff on the last(?) page to another page making a
mess of things.

I think you would be way better off if you could find some
other way of making the page footer visible on the last
page. Perhaps making it visible in the report footer
section or the last detail can get what you want.

Note that in some(?) versions of Access, the space for the
page footer can be made available for details,etc. only if
the page footer is made invisible in the page header
section. If the page footer was invisible while the details
were processed and there may not be space for it when the
footer suddenly becomes visible (resulting in something
rather odd).
 
D

diablowrym via AccessMonster.com

OK, I'm clueless sometimes..lol
Even though this code looks backwards what it does is allows to pagefooter
section to be printed on the first page of the report and not any others.
This how it works in the 2003 version. In the 2007 version it prints an empty
space where it would be on the first page.

I'm thinking what's happening is what you are saying. It is putting the
footer at the bottom of every page (but page one) and since there is less
room on all those pages it gives a higher count. But when it goes back the
second time, it takes all those out so the data needs less room, hence wrong
page count.

Ok going to need another way to have the pagefooter on the first page only or
manually put in the number of page after a print preview.

Thanks for your help Marshall.
Point

Marshall said:
I asked this question in another post. This code is working in my 2003
version but not the 2007. Both versions I'm getting the wrong page counts.
[quoted text clipped - 8 lines]

"Not working" is a singularly clue free statement. I
haven't played with A2007 enough to know the nuances of this
problem so I will only try to address the A2003 side of it.

First, when you use a text box with Pages, it causes Access
to process the report two times. The first time, it tries
to figure out how many pages are in the report so Pages can
have a value the next time through. Because the value of
Pages is not known the first time through, its value is 0
(zero). This means that your code always makes the page
footer invisible during the first pass (even on the "last"
page). When the page number gets to the calculated value of
Pages during the second pass, then the page footer will be
made visible. But the page footer being visible may(?) push
other stuff on the last(?) page to another page making a
mess of things.

I think you would be way better off if you could find some
other way of making the page footer visible on the last
page. Perhaps making it visible in the report footer
section or the last detail can get what you want.

Note that in some(?) versions of Access, the space for the
page footer can be made available for details,etc. only if
the page footer is made invisible in the page header
section. If the page footer was invisible while the details
were processed and there may not be space for it when the
footer suddenly becomes visible (resulting in something
rather odd).
 
M

Marshall Barton

diablowrym said:
OK, I'm clueless sometimes..lol
Even though this code looks backwards what it does is allows to pagefooter
section to be printed on the first page of the report and not any others.
This how it works in the 2003 version. In the 2007 version it prints an empty
space where it would be on the first page.

I'm thinking what's happening is what you are saying. It is putting the
footer at the bottom of every page (but page one) and since there is less
room on all those pages it gives a higher count. But when it goes back the
second time, it takes all those out so the data needs less room, hence wrong
page count.

Ok going to need another way to have the pagefooter on the first page only or
manually put in the number of page after a print preview.


Depending on the size of the page footer, maybe you can
leave it visible on every page and just hide all the
controls??

Stating the obvious, why not do away with the page footer
and just use the report footer?
 
D

diablowrym via AccessMonster.com

I am matching a form that the department where we store records uses. They
said we couldn't change it, so I'm pushing it a little with what I'm doing
here.
I thought about using the report footer, but haven't found a way to make it
print on the first page of the report instead of the last.

Marshall said:
OK, I'm clueless sometimes..lol
Even though this code looks backwards what it does is allows to pagefooter
[quoted text clipped - 10 lines]
Ok going to need another way to have the pagefooter on the first page only or
manually put in the number of page after a print preview.

Depending on the size of the page footer, maybe you can
leave it visible on every page and just hide all the
controls??

Stating the obvious, why not do away with the page footer
and just use the report footer?
 
M

Marshall Barton

diablowrym said:
I am matching a form that the department where we store records uses. They
said we couldn't change it, so I'm pushing it a little with what I'm doing
here.
I thought about using the report footer, but haven't found a way to make it
print on the first page of the report instead of the last.

Marshall said:
OK, I'm clueless sometimes..lol
Even though this code looks backwards what it does is allows to pagefooter
[quoted text clipped - 10 lines]
Ok going to need another way to have the pagefooter on the first page only or
manually put in the number of page after a print preview.

Depending on the size of the page footer, maybe you can
leave it visible on every page and just hide all the
controls??

Stating the obvious, why not do away with the page footer
and just use the report footer?

I think I may be working on the wrong problem. You
initially said you want the Page footer only on the LAST
page, but at other times you talk about someting or other on
the FIRST page. Please try explaining what information is
supposed to go where, not how you tried to accomplish it.
 
D

diablowrym via AccessMonster.com

I want to have the page footer ONLY on the FIRST page of a multiple page
report.

Marshall said:
I am matching a form that the department where we store records uses. They
said we couldn't change it, so I'm pushing it a little with what I'm doing
[quoted text clipped - 14 lines]
I think I may be working on the wrong problem. You
initially said you want the Page footer only on the LAST
page, but at other times you talk about someting or other on
the FIRST page. Please try explaining what information is
supposed to go where, not how you tried to accomplish it.
 
M

Marshall Barton

Use this kind of code in the Page ***Header*** section's
Format or Print event:
Me.Section(4).Visible = (Me.Page = 1)
--
Marsh
MVP [MS Access]

I want to have the page footer ONLY on the FIRST page of a multiple page
report.

Marshall said:
I am matching a form that the department where we store records uses. They
said we couldn't change it, so I'm pushing it a little with what I'm doing
[quoted text clipped - 14 lines]
Stating the obvious, why not do away with the page footer
and just use the report footer?

I think I may be working on the wrong problem. You
initially said you want the Page footer only on the LAST
page, but at other times you talk about someting or other on
the FIRST page. Please try explaining what information is
supposed to go where, not how you tried to accomplish it.
 

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