A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Print page footer only when needed



 
 
Thread Tools Display Modes
  #1  
Old November 7th, 2005, 08:07 PM
Carl Rapson
external usenet poster
 
Posts: n/a
Default Print page footer only when needed

I've got a report that may or may not exceed one page, including the report
footer. I would like to include a page footer on the first page only if the
report exceeds one page. I set the report PageFooter property to "Not with
Rpt Ftr", which prevents the page footer from printing on the second page
when there is one. However, it appears that the report really wants to print
the page footer section, whether it is needed or not. For example, on a
report that does NOT exceed one page, including the report footer, the page
footer is still printed, which causes the report footer to wrap to the
second page. If the page footer didn't print, the entire report would fit on
one page (I've tested it). Is there any way to prevent the page footer
section from printing if it isn't really needed?

Thanks for any assistance,

Carl Rapson


  #2  
Old November 7th, 2005, 10:44 PM
Datasort
external usenet poster
 
Posts: n/a
Default Print page footer only when needed

Carl,

Add this code to the report's module

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
If Me.Pages = 1 Then Cancel = True
End Sub

This will prevent the footer from printing if the report is only one page.
The cancel = true really means do not print (create the fotmat)

If this solves your problem then please check the answered box.

--
Stewart Rogers
DataSort Software, L.C.


"Carl Rapson" wrote:

I've got a report that may or may not exceed one page, including the report
footer. I would like to include a page footer on the first page only if the
report exceeds one page. I set the report PageFooter property to "Not with
Rpt Ftr", which prevents the page footer from printing on the second page
when there is one. However, it appears that the report really wants to print
the page footer section, whether it is needed or not. For example, on a
report that does NOT exceed one page, including the report footer, the page
footer is still printed, which causes the report footer to wrap to the
second page. If the page footer didn't print, the entire report would fit on
one page (I've tested it). Is there any way to prevent the page footer
section from printing if it isn't really needed?

Thanks for any assistance,

Carl Rapson



  #3  
Old November 9th, 2005, 07:21 PM
Carl Rapson
external usenet poster
 
Posts: n/a
Default Print page footer only when needed

Thanks for the suggestion. Unfortunately, when I placed the code in the
ReportFooter_Format section, I still get the page footer on single-page
reports, causing the report footer to wrap to the next page. I stepped
through the code, and the ReportFooter section was called twice - once with
the Pages property set to zero, and once with the Pages property set to 2. I
tried changing the If statement to

If Me.Pages = 0 Then Cancel = True

but the page footer still printed on the first page. I also tried the
following line in the ReportFooter section:

If (Me.Pages = 0) Or (Me.Page Me.Pages) Then Cancel = True

When I did that, the page footer didn't print on the first page, but the
space for the page footer was left blank at the bottom of the first page -
and the report footer still wrapped to the next page. If I remove the Page
footer section completely from my report, the report prints in a single page
(including the report footer).

Might you have any other ideas? Thanks,

Carl Rapson

"Datasort" wrote in message
...
Carl,

Add this code to the report's module

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
If Me.Pages = 1 Then Cancel = True
End Sub

This will prevent the footer from printing if the report is only one page.
The cancel = true really means do not print (create the fotmat)

If this solves your problem then please check the answered box.

--
Stewart Rogers
DataSort Software, L.C.


"Carl Rapson" wrote:

I've got a report that may or may not exceed one page, including the
report
footer. I would like to include a page footer on the first page only if
the
report exceeds one page. I set the report PageFooter property to "Not
with
Rpt Ftr", which prevents the page footer from printing on the second page
when there is one. However, it appears that the report really wants to
print
the page footer section, whether it is needed or not. For example, on a
report that does NOT exceed one page, including the report footer, the
page
footer is still printed, which causes the report footer to wrap to the
second page. If the page footer didn't print, the entire report would fit
on
one page (I've tested it). Is there any way to prevent the page footer
section from printing if it isn't really needed?

Thanks for any assistance,

Carl Rapson





  #4  
Old November 10th, 2005, 04:42 PM
Datasort
external usenet poster
 
Posts: n/a
Default Print page footer only when needed

Carl,

I think that access is a 2 pass report system. This means that the system
tries to generate the report twice for formatting. This is a long shot but
.... can you tell how much data is going to print? Is it possible to do a row
count on the detail section and determine when you are going to run over to a
new page. If you can derermine that, maybe on open event could count the
rows from the query and turn on/off the footer. Please let me know if this
works.

Best of luck ...

--
Stewart Rogers
DataSort Software, L.C.


"Datasort" wrote:

Carl,

Add this code to the report's module

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
If Me.Pages = 1 Then Cancel = True
End Sub

This will prevent the footer from printing if the report is only one page.
The cancel = true really means do not print (create the fotmat)

If this solves your problem then please check the answered box.

--
Stewart Rogers
DataSort Software, L.C.


"Carl Rapson" wrote:

I've got a report that may or may not exceed one page, including the report
footer. I would like to include a page footer on the first page only if the
report exceeds one page. I set the report PageFooter property to "Not with
Rpt Ftr", which prevents the page footer from printing on the second page
when there is one. However, it appears that the report really wants to print
the page footer section, whether it is needed or not. For example, on a
report that does NOT exceed one page, including the report footer, the page
footer is still printed, which causes the report footer to wrap to the
second page. If the page footer didn't print, the entire report would fit on
one page (I've tested it). Is there any way to prevent the page footer
section from printing if it isn't really needed?

Thanks for any assistance,

Carl Rapson



  #5  
Old November 10th, 2005, 06:00 PM
Marshall Barton
external usenet poster
 
Posts: n/a
Default Print page footer only when needed

Carl Rapson wrote:

I've got a report that may or may not exceed one page, including the report
footer. I would like to include a page footer on the first page only if the
report exceeds one page. I set the report PageFooter property to "Not with
Rpt Ftr", which prevents the page footer from printing on the second page
when there is one. However, it appears that the report really wants to print
the page footer section, whether it is needed or not. For example, on a
report that does NOT exceed one page, including the report footer, the page
footer is still printed, which causes the report footer to wrap to the
second page. If the page footer didn't print, the entire report would fit on
one page (I've tested it). Is there any way to prevent the page footer
section from printing if it isn't really needed?



I think you have to do this in the Page Header Format event
to be able to reclaim the space reserved for the page
footer.

Me.Section(5).Visible = (Me.Page = 1 And Me.Pages 1)

Note that Me.Pages will not work unless you have a text box
somewhere on the report that refers to Pages.

--
Marsh
MVP [MS Access]
  #6  
Old November 11th, 2005, 03:29 PM
Carl Rapson
external usenet poster
 
Posts: n/a
Default Print page footer only when needed

Stewart,

Thanks again for the suggestion. Unfortunately, my Detail section isn't that
simple. It consists of a series of subreports, each of which Can Grow. I
don't know how to tell beforehand how many "detail lines" I have, since I
don't really have detail lines.

Carl Rapson

"Datasort" wrote in message
...
Carl,

I think that access is a 2 pass report system. This means that the system
tries to generate the report twice for formatting. This is a long shot
but
... can you tell how much data is going to print? Is it possible to do a
row
count on the detail section and determine when you are going to run over
to a
new page. If you can derermine that, maybe on open event could count the
rows from the query and turn on/off the footer. Please let me know if
this
works.

Best of luck ...

--
Stewart Rogers
DataSort Software, L.C.


"Datasort" wrote:

Carl,

Add this code to the report's module

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As
Integer)
If Me.Pages = 1 Then Cancel = True
End Sub

This will prevent the footer from printing if the report is only one
page.
The cancel = true really means do not print (create the fotmat)

If this solves your problem then please check the answered box.

--
Stewart Rogers
DataSort Software, L.C.


"Carl Rapson" wrote:

I've got a report that may or may not exceed one page, including the
report
footer. I would like to include a page footer on the first page only if
the
report exceeds one page. I set the report PageFooter property to "Not
with
Rpt Ftr", which prevents the page footer from printing on the second
page
when there is one. However, it appears that the report really wants to
print
the page footer section, whether it is needed or not. For example, on a
report that does NOT exceed one page, including the report footer, the
page
footer is still printed, which causes the report footer to wrap to the
second page. If the page footer didn't print, the entire report would
fit on
one page (I've tested it). Is there any way to prevent the page footer
section from printing if it isn't really needed?

Thanks for any assistance,

Carl Rapson





  #7  
Old November 11th, 2005, 03:51 PM
Carl Rapson
external usenet poster
 
Posts: n/a
Default Print page footer only when needed

"Marshall Barton" wrote in message
...
Carl Rapson wrote:

I've got a report that may or may not exceed one page, including the
report
footer. I would like to include a page footer on the first page only if
the
report exceeds one page. I set the report PageFooter property to "Not with
Rpt Ftr", which prevents the page footer from printing on the second page
when there is one. However, it appears that the report really wants to
print
the page footer section, whether it is needed or not. For example, on a
report that does NOT exceed one page, including the report footer, the
page
footer is still printed, which causes the report footer to wrap to the
second page. If the page footer didn't print, the entire report would fit
on
one page (I've tested it). Is there any way to prevent the page footer
section from printing if it isn't really needed?



I think you have to do this in the Page Header Format event
to be able to reclaim the space reserved for the page
footer.

Me.Section(5).Visible = (Me.Page = 1 And Me.Pages 1)

Note that Me.Pages will not work unless you have a text box
somewhere on the report that refers to Pages.

--
Marsh
MVP [MS Access]


Marshall,

Thanks for the suggestion. I placed the code in the PageHeaderSection_Format
event (I changed Section(5) to Section(acPageFooter)), with the following
results:

For reports that are only one page, I got a single page, but the number of
pages still seems to be 2. I have a text box in the report footer section
with a Control Source of "=[Page] of [Pages]", and it displays as "Page 1 of
2". Otherwise, the report printed the way I want it to.

For reports that are more than one page, I don't get the page footer section
at all on the first page. That makes sense, because the line I added to the
page header section prevents the page footer from printing, even when it
legitimately should print. Unfortunately, I don't want this to happen.

What I need is for the page footer section to print on the first page only
when the report would have more than one page without the page footer. If
the report would have only one page without the page footer, I don't want
the page footer to print. But the report seems to be reserving space for the
page footer, whether it's needed or not. I set the report's Page Footer
property to Not with Rpt Hdr, but it appears that Access really wants to
print the page footer at least once, even if it isn't needed. I welcome any
suggestions about how to solve this.

One thing I'm going to try is a redesign of my report, to place all of the
subreports now in the Detail section into group header/footer sections. I
want to see if that might have an effect on this problem.

Thanks again for your assistance,

Carl Rapson


  #8  
Old November 11th, 2005, 08:26 PM
Marshall Barton
external usenet poster
 
Posts: n/a
Default Print page footer only when needed

Carl Rapson wrote:

"Marshall Barton" wrote
Carl Rapson wrote:
I've got a report that may or may not exceed one page, including the
report
footer. I would like to include a page footer on the first page only if
the
report exceeds one page. I set the report PageFooter property to "Not with
Rpt Ftr", which prevents the page footer from printing on the second page
when there is one. However, it appears that the report really wants to
print
the page footer section, whether it is needed or not. For example, on a
report that does NOT exceed one page, including the report footer, the
page
footer is still printed, which causes the report footer to wrap to the
second page. If the page footer didn't print, the entire report would fit
on
one page (I've tested it). Is there any way to prevent the page footer
section from printing if it isn't really needed?



I think you have to do this in the Page Header Format event
to be able to reclaim the space reserved for the page
footer.

Me.Section(5).Visible = (Me.Page = 1 And Me.Pages 1)

Note that Me.Pages will not work unless you have a text box
somewhere on the report that refers to Pages.


Thanks for the suggestion. I placed the code in the PageHeaderSection_Format
event (I changed Section(5) to Section(acPageFooter)), with the following
results:

For reports that are only one page, I got a single page, but the number of
pages still seems to be 2. I have a text box in the report footer section
with a Control Source of "=[Page] of [Pages]", and it displays as "Page 1 of
2". Otherwise, the report printed the way I want it to.

For reports that are more than one page, I don't get the page footer section
at all on the first page. That makes sense, because the line I added to the
page header section prevents the page footer from printing, even when it
legitimately should print. Unfortunately, I don't want this to happen.

What I need is for the page footer section to print on the first page only
when the report would have more than one page without the page footer. If
the report would have only one page without the page footer, I don't want
the page footer to print. But the report seems to be reserving space for the
page footer, whether it's needed or not. I set the report's Page Footer
property to Not with Rpt Hdr, but it appears that Access really wants to
print the page footer at least once, even if it isn't needed. I welcome any
suggestions about how to solve this.

One thing I'm going to try is a redesign of my report, to place all of the
subreports now in the Detail section into group header/footer sections. I
want to see if that might have an effect on this problem.


Just in case something was lost in translation, you need to
post the code you are actually using.

The code I posted should work if the report has more than
one page.

It should also work if there is only one page.

But, the situation where the last page has Page 1 of 2 is a
problem. Let's try beefing up the code:

Me.Section(5).Visible = (Me.Page = 1 _
And (Me.Pages 1 Or Me.Pages = 0)

--
Marsh
MVP [MS Access]
  #9  
Old November 14th, 2005, 04:19 PM
Carl Rapson
external usenet poster
 
Posts: n/a
Default Print page footer only when needed


"Marshall Barton" wrote in message
...
Carl Rapson wrote:

"Marshall Barton" wrote
Carl Rapson wrote:
I've got a report that may or may not exceed one page, including the
report
footer. I would like to include a page footer on the first page only if
the
report exceeds one page. I set the report PageFooter property to "Not
with
Rpt Ftr", which prevents the page footer from printing on the second
page
when there is one. However, it appears that the report really wants to
print
the page footer section, whether it is needed or not. For example, on a
report that does NOT exceed one page, including the report footer, the
page
footer is still printed, which causes the report footer to wrap to the
second page. If the page footer didn't print, the entire report would
fit
on
one page (I've tested it). Is there any way to prevent the page footer
section from printing if it isn't really needed?


I think you have to do this in the Page Header Format event
to be able to reclaim the space reserved for the page
footer.

Me.Section(5).Visible = (Me.Page = 1 And Me.Pages 1)

Note that Me.Pages will not work unless you have a text box
somewhere on the report that refers to Pages.


Thanks for the suggestion. I placed the code in the
PageHeaderSection_Format
event (I changed Section(5) to Section(acPageFooter)), with the following
results:

For reports that are only one page, I got a single page, but the number of
pages still seems to be 2. I have a text box in the report footer section
with a Control Source of "=[Page] of [Pages]", and it displays as "Page 1
of
2". Otherwise, the report printed the way I want it to.

For reports that are more than one page, I don't get the page footer
section
at all on the first page. That makes sense, because the line I added to
the
page header section prevents the page footer from printing, even when it
legitimately should print. Unfortunately, I don't want this to happen.

What I need is for the page footer section to print on the first page only
when the report would have more than one page without the page footer. If
the report would have only one page without the page footer, I don't want
the page footer to print. But the report seems to be reserving space for
the
page footer, whether it's needed or not. I set the report's Page Footer
property to Not with Rpt Hdr, but it appears that Access really wants to
print the page footer at least once, even if it isn't needed. I welcome
any
suggestions about how to solve this.

One thing I'm going to try is a redesign of my report, to place all of the
subreports now in the Detail section into group header/footer sections. I
want to see if that might have an effect on this problem.


Just in case something was lost in translation, you need to
post the code you are actually using.

The code I posted should work if the report has more than
one page.

It should also work if there is only one page.

But, the situation where the last page has Page 1 of 2 is a
problem. Let's try beefing up the code:

Me.Section(5).Visible = (Me.Page = 1 _
And (Me.Pages 1 Or Me.Pages = 0)

--
Marsh
MVP [MS Access]


Marshall,

Here is the code I added to my PageHeaderSection_Format event:

If ((Me.Page = 1) And ((Me.Pages 1) Or (Me.Pages = 0))) Then
Me.Section(acPageFooter).Visible = False
End If

I changed the "5" to "acPageFooter", because the on-line help indicated that
the Page Footer section is actually 4, not 5. I thought that using the
constant would be better than a hard-coded value. However, using values of
both 4 and 5 didn't seem to make any difference in which sections printed.

With the above code in my page header section, I still get the page footer
printing on a report that should only be one page. I tested this by
completely removing the page footer section from the report; when I did, the
report printed on a single page (although I then have the problem of the
report saying "Page 1 of 2", even though there's only one page).

One thing I have learned is that this problem may be related to the height
of the report. My top and bottom margins are set to 0.166", which I suspect
may be too little for the printer I am using. I found that removing a
segment of my Detail section allows the report to print on a single page.
This seems inconsistent with the report printing on a single page when the
page footer is removed. I may have to redesign the form to make this work.

Thanks for your assistance,

Carl Rapson


  #10  
Old November 14th, 2005, 07:57 PM
Marshall Barton
external usenet poster
 
Posts: n/a
Default Print page footer only when needed

Carl Rapson wrote:
"Marshall Barton" wrote
Carl Rapson wrote:
"Marshall Barton" wrote
Carl Rapson wrote:
I've got a report that may or may not exceed one page, including the
report
footer. I would like to include a page footer on the first page only if
the
report exceeds one page. I set the report PageFooter property to "Not
with
Rpt Ftr", which prevents the page footer from printing on the second
page
when there is one. However, it appears that the report really wants to
print
the page footer section, whether it is needed or not. For example, on a
report that does NOT exceed one page, including the report footer, the
page
footer is still printed, which causes the report footer to wrap to the
second page. If the page footer didn't print, the entire report would
fit
on
one page (I've tested it). Is there any way to prevent the page footer
section from printing if it isn't really needed?


I think you have to do this in the Page Header Format event
to be able to reclaim the space reserved for the page
footer.

Me.Section(5).Visible = (Me.Page = 1 And Me.Pages 1)

Note that Me.Pages will not work unless you have a text box
somewhere on the report that refers to Pages.


Thanks for the suggestion. I placed the code in the
PageHeaderSection_Format
event (I changed Section(5) to Section(acPageFooter)), with the following
results:

For reports that are only one page, I got a single page, but the number of
pages still seems to be 2. I have a text box in the report footer section
with a Control Source of "=[Page] of [Pages]", and it displays as "Page 1
of
2". Otherwise, the report printed the way I want it to.

For reports that are more than one page, I don't get the page footer
section
at all on the first page. That makes sense, because the line I added to
the
page header section prevents the page footer from printing, even when it
legitimately should print. Unfortunately, I don't want this to happen.

What I need is for the page footer section to print on the first page only
when the report would have more than one page without the page footer. If
the report would have only one page without the page footer, I don't want
the page footer to print. But the report seems to be reserving space for
the
page footer, whether it's needed or not. I set the report's Page Footer
property to Not with Rpt Hdr, but it appears that Access really wants to
print the page footer at least once, even if it isn't needed. I welcome
any
suggestions about how to solve this.

One thing I'm going to try is a redesign of my report, to place all of the
subreports now in the Detail section into group header/footer sections. I
want to see if that might have an effect on this problem.


Just in case something was lost in translation, you need to
post the code you are actually using.

The code I posted should work if the report has more than
one page.

It should also work if there is only one page.

But, the situation where the last page has Page 1 of 2 is a
problem. Let's try beefing up the code:

Me.Section(5).Visible = (Me.Page = 1 _
And (Me.Pages 1 Or Me.Pages = 0)

--
Marsh
MVP [MS Access]


Marshall,

Here is the code I added to my PageHeaderSection_Format event:

If ((Me.Page = 1) And ((Me.Pages 1) Or (Me.Pages = 0))) Then
Me.Section(acPageFooter).Visible = False
End If

I changed the "5" to "acPageFooter", because the on-line help indicated that
the Page Footer section is actually 4, not 5. I thought that using the
constant would be better than a hard-coded value. However, using values of
both 4 and 5 didn't seem to make any difference in which sections printed.

With the above code in my page header section, I still get the page footer
printing on a report that should only be one page. I tested this by
completely removing the page footer section from the report; when I did, the
report printed on a single page (although I then have the problem of the
report saying "Page 1 of 2", even though there's only one page).

One thing I have learned is that this problem may be related to the height
of the report. My top and bottom margins are set to 0.166", which I suspect
may be too little for the printer I am using. I found that removing a
segment of my Detail section allows the report to print on a single page.
This seems inconsistent with the report printing on a single page when the
page footer is removed. I may have to redesign the form to make this work.



The top and bottom margins should not be impacting this
situation. If your printer (driver) accepts the settings,
then you will only run into problems when you use a
different printer that requires larger margins.

Back to the original problem. I created a report that
reproduces what you are trying to do and could not get it to
work at all in AXP. This is different from what I remember
in A97 and earlier. Failing memory aside, I think Access
was changed somewhere along the line so that if the page
footer is made visible anywhere in the report, the space it
consumes is reserved on all pages.

Bottom line, unless someone else has another approach, I
think you are out of luck on this one.

--
Marsh
MVP [MS Access]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
page setup landscape, but print footer in portrait mode msvflyhigh General Discussion 10 October 22nd, 2007 11:01 PM
How to keep the report footer on the same page? homer Setting Up & Running Reports 3 October 21st, 2005 07:27 PM
Auto numbering store5064 General Discussions 11 June 2nd, 2005 08:38 PM
Access Mail Merge to Word.doc files ? RNUSZ@OKDPS Setting Up & Running Reports 1 May 18th, 2005 06:31 PM
Need variable-sized box at end of page before page footer Deb Setting Up & Running Reports 5 October 15th, 2004 01:22 AM


All times are GMT +1. The time now is 12:55 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.