Report Footer Problem

G

Guest

This ought to be simple, but I'm going round in circles...

I have designed a report to use as an Invoice. It has report
header/pageheader/detail/pagefooter/reportfooter.

If the invoice takes up more than one page, I want:

Report Header on 1st Page only
Page Header on all other pages
Page Footer an all pages except the final page
Report Footer on final page only

Where I am falling down is that I want the Report Footer on the last page.
What should be the last page shows the Page Footer instead, forcing an extra
unwanted page for the Report Footer.

In layman's terms, this means that my invoice is not showing the totals on
the page where the detail ends, which is a basic requirement of invoice
design.

Help gratefully received.
Ian
 
M

Marshall Barton

Ian said:
This ought to be simple, but I'm going round in circles...

I have designed a report to use as an Invoice. It has report
header/pageheader/detail/pagefooter/reportfooter.

If the invoice takes up more than one page, I want:

Report Header on 1st Page only
Page Header on all other pages
Page Footer an all pages except the final page
Report Footer on final page only

Where I am falling down is that I want the Report Footer on the last page.
What should be the last page shows the Page Footer instead, forcing an extra
unwanted page for the Report Footer.

In layman's terms, this means that my invoice is not showing the totals on
the page where the detail ends, which is a basic requirement of invoice
design.


The report has a PageHeader property. Set it to
Not with Rpt Hdr
to prevent the page header on the first page.

To suppress the page footer on the last page, you need to
make it invisible in the page header section's Format event
procedure.

The trick to figuring out when you are on the last page is
to add a text box with an expression that uses the Pages
property (e.g. Page & " of " & Pages). Then the code for
the page **header** would be:
Me.Section(4).Visible = (Me.Page <> Me.Pages)
 
G

Guest

Hi,

This did not work. The page header is no problem. It is the page footer
appearing on what should be the last page, forcing an extra page for the
report footer that is the problem. I placed a text box in the page footer
with the expression "Page " & [Page] & " of " & [Pages]. I then entered the
following code in the Page Header OnFormat event:

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
Me.Section(4).Visible = (Me.Page <> Me.Pages)

End Sub

It has made no difference I'm afraid.

What prints is this:
Page 1: Report Header | Detail | Page Footer
Page 2: Page Header | Detail (final details) | Page Footer
Page 3: Page Header | Report Footer

What I want is :
Page 1: Report Header | Detail | Page Footer
Page 2: Page Header | Detail (final details) | Report Footer

There is no need for page 3.

Many Thanks

Ian
 
M

Marshall Barton

Let's back up and make sure things are setup the way I
thought.

Check that the Report Footer section's ForceNewPage property
is set to None.

Double check that the report footer section's Height
property is no bigger than the page footer's Height
property.

Also double check that setting the Report's PageFooter
property to Not with Rpt Ftr did not take care of things
without fooling around with all this other stuff.
--
Marsh
MVP [MS Access]


Ian said:
This did not work. The page header is no problem. It is the page footer
appearing on what should be the last page, forcing an extra page for the
report footer that is the problem. I placed a text box in the page footer
with the expression "Page " & [Page] & " of " & [Pages]. I then entered the
following code in the Page Header OnFormat event:

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
Me.Section(4).Visible = (Me.Page <> Me.Pages)

End Sub

It has made no difference I'm afraid.

What prints is this:
Page 1: Report Header | Detail | Page Footer
Page 2: Page Header | Detail (final details) | Page Footer
Page 3: Page Header | Report Footer

What I want is :
Page 1: Report Header | Detail | Page Footer
Page 2: Page Header | Detail (final details) | Report Footer

There is no need for page 3.


Marshall Barton said:
The report has a PageHeader property. Set it to
Not with Rpt Hdr
to prevent the page header on the first page.

To suppress the page footer on the last page, you need to
make it invisible in the page header section's Format event
procedure.

The trick to figuring out when you are on the last page is
to add a text box with an expression that uses the Pages
property (e.g. Page & " of " & Pages). Then the code for
the page **header** would be:
Me.Section(4).Visible = (Me.Page <> Me.Pages)
 
G

Guest

Hi, thanks for your continued help...

Answers in CAPS Below....

Marshall Barton said:
Let's back up and make sure things are setup the way I
thought.

Check that the Report Footer section's ForceNewPage property
is set to None. IT IS SET TO NONE

Double check that the report footer section's Height
property is no bigger than the page footer's Height
property. REPORT FOOTER HEIGHT 10.478cm, PAGE FOOTER HEIGHT 10.476cm - CHANGING IT TO 10.48cm MADE NO DIFFERENCE.

Also double check that setting the Report's PageFooter
property to Not with Rpt Ftr did not take care of things
without fooling around with all this other stuff. THIS IS SET AS YOU DESCRIBE HERE.
--
Marsh
MVP [MS Access]


Ian said:
This did not work. The page header is no problem. It is the page footer
appearing on what should be the last page, forcing an extra page for the
report footer that is the problem. I placed a text box in the page footer
with the expression "Page " & [Page] & " of " & [Pages]. I then entered the
following code in the Page Header OnFormat event:

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
Me.Section(4).Visible = (Me.Page <> Me.Pages)

End Sub

It has made no difference I'm afraid.

What prints is this:
Page 1: Report Header | Detail | Page Footer
Page 2: Page Header | Detail (final details) | Page Footer
Page 3: Page Header | Report Footer

What I want is :
Page 1: Report Header | Detail | Page Footer
Page 2: Page Header | Detail (final details) | Report Footer

There is no need for page 3.


Marshall Barton said:
Ian Bateman wrote:

This ought to be simple, but I'm going round in circles...

I have designed a report to use as an Invoice. It has report
header/pageheader/detail/pagefooter/reportfooter.

If the invoice takes up more than one page, I want:

Report Header on 1st Page only
Page Header on all other pages
Page Footer an all pages except the final page
Report Footer on final page only

Where I am falling down is that I want the Report Footer on the last page.
What should be the last page shows the Page Footer instead, forcing an extra
unwanted page for the Report Footer.

In layman's terms, this means that my invoice is not showing the totals on
the page where the detail ends, which is a basic requirement of invoice
design.


The report has a PageHeader property. Set it to
Not with Rpt Hdr
to prevent the page header on the first page.

To suppress the page footer on the last page, you need to
make it invisible in the page header section's Format event
procedure.

The trick to figuring out when you are on the last page is
to add a text box with an expression that uses the Pages
property (e.g. Page & " of " & Pages). Then the code for
the page **header** would be:
Me.Section(4).Visible = (Me.Page <> Me.Pages)
 
M

Marshall Barton

I think they've changed this behavior in A2002. It's more
complicated than I remember.

Add a hidden text box named txtMaxPage to the report header
section. Then put this code in the in the Detail section's
Format event procedure:

If Me.Pages = 0 Then
Me.txtMaxPage = Me.Page
End If

Finally, change the code in the Page Header section's format
event
Me.Section(4).Visible = (Me.txtMaxPage <> Me.Page)

Now the messy part. For some reason this arrangement is one
of those situations where the value of Pages is wrong. To
get the correct(?) display, make the =Page of Pages text box
invisible and use a new text box with the expression:
=Page & " of " txtMaxPage
--
Marsh
MVP [MS Access]


Ian said:
Hi, thanks for your continued help...

Answers in CAPS Below....

Marshall Barton said:
Let's back up and make sure things are setup the way I
thought.

Check that the Report Footer section's ForceNewPage property
is set to None. IT IS SET TO NONE

Double check that the report footer section's Height
property is no bigger than the page footer's Height
property. REPORT FOOTER HEIGHT 10.478cm, PAGE FOOTER HEIGHT 10.476cm - CHANGING IT TO 10.48cm MADE NO DIFFERENCE.

Also double check that setting the Report's PageFooter
property to Not with Rpt Ftr did not take care of things
without fooling around with all this other stuff. THIS IS SET AS YOU DESCRIBE HERE.


Ian said:
This did not work. The page header is no problem. It is the page footer
appearing on what should be the last page, forcing an extra page for the
report footer that is the problem. I placed a text box in the page footer
with the expression "Page " & [Page] & " of " & [Pages]. I then entered the
following code in the Page Header OnFormat event:

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
Me.Section(4).Visible = (Me.Page <> Me.Pages)

End Sub

It has made no difference I'm afraid.

What prints is this:
Page 1: Report Header | Detail | Page Footer
Page 2: Page Header | Detail (final details) | Page Footer
Page 3: Page Header | Report Footer

What I want is :
Page 1: Report Header | Detail | Page Footer
Page 2: Page Header | Detail (final details) | Report Footer

There is no need for page 3.


:

Ian Bateman wrote:

This ought to be simple, but I'm going round in circles...

I have designed a report to use as an Invoice. It has report
header/pageheader/detail/pagefooter/reportfooter.

If the invoice takes up more than one page, I want:

Report Header on 1st Page only
Page Header on all other pages
Page Footer an all pages except the final page
Report Footer on final page only

Where I am falling down is that I want the Report Footer on the last page.
What should be the last page shows the Page Footer instead, forcing an extra
unwanted page for the Report Footer.

In layman's terms, this means that my invoice is not showing the totals on
the page where the detail ends, which is a basic requirement of invoice
design.


The report has a PageHeader property. Set it to
Not with Rpt Hdr
to prevent the page header on the first page.

To suppress the page footer on the last page, you need to
make it invisible in the page header section's Format event
procedure.

The trick to figuring out when you are on the last page is
to add a text box with an expression that uses the Pages
property (e.g. Page & " of " & Pages). Then the code for
the page **header** would be:
Me.Section(4).Visible = (Me.Page <> Me.Pages)
 
G

Guest

Many thanks Marshall - that sorted it out! It's a bit of a howler that we
have to go through such a routine to do something that is surely a basic
requirement of invoice design. There we go..

One last thing, how can I make the report footer stay at the bottom of the
page?

Thanks
Ian

Marshall Barton said:
I think they've changed this behavior in A2002. It's more
complicated than I remember.

Add a hidden text box named txtMaxPage to the report header
section. Then put this code in the in the Detail section's
Format event procedure:

If Me.Pages = 0 Then
Me.txtMaxPage = Me.Page
End If

Finally, change the code in the Page Header section's format
event
Me.Section(4).Visible = (Me.txtMaxPage <> Me.Page)

Now the messy part. For some reason this arrangement is one
of those situations where the value of Pages is wrong. To
get the correct(?) display, make the =Page of Pages text box
invisible and use a new text box with the expression:
=Page & " of " txtMaxPage
--
Marsh
MVP [MS Access]


Ian said:
Hi, thanks for your continued help...

Answers in CAPS Below....

Marshall Barton said:
Let's back up and make sure things are setup the way I
thought.

Check that the Report Footer section's ForceNewPage property
is set to None. IT IS SET TO NONE

Double check that the report footer section's Height
property is no bigger than the page footer's Height
property. REPORT FOOTER HEIGHT 10.478cm, PAGE FOOTER HEIGHT 10.476cm - CHANGING IT TO 10.48cm MADE NO DIFFERENCE.

Also double check that setting the Report's PageFooter
property to Not with Rpt Ftr did not take care of things
without fooling around with all this other stuff. THIS IS SET AS YOU DESCRIBE HERE.


Ian Bateman wrote:
This did not work. The page header is no problem. It is the page footer
appearing on what should be the last page, forcing an extra page for the
report footer that is the problem. I placed a text box in the page footer
with the expression "Page " & [Page] & " of " & [Pages]. I then entered the
following code in the Page Header OnFormat event:

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
Me.Section(4).Visible = (Me.Page <> Me.Pages)

End Sub

It has made no difference I'm afraid.

What prints is this:
Page 1: Report Header | Detail | Page Footer
Page 2: Page Header | Detail (final details) | Page Footer
Page 3: Page Header | Report Footer

What I want is :
Page 1: Report Header | Detail | Page Footer
Page 2: Page Header | Detail (final details) | Report Footer

There is no need for page 3.


:

Ian Bateman wrote:

This ought to be simple, but I'm going round in circles...

I have designed a report to use as an Invoice. It has report
header/pageheader/detail/pagefooter/reportfooter.

If the invoice takes up more than one page, I want:

Report Header on 1st Page only
Page Header on all other pages
Page Footer an all pages except the final page
Report Footer on final page only

Where I am falling down is that I want the Report Footer on the last page.
What should be the last page shows the Page Footer instead, forcing an extra
unwanted page for the Report Footer.

In layman's terms, this means that my invoice is not showing the totals on
the page where the detail ends, which is a basic requirement of invoice
design.


The report has a PageHeader property. Set it to
Not with Rpt Hdr
to prevent the page header on the first page.

To suppress the page footer on the last page, you need to
make it invisible in the page header section's Format event
procedure.

The trick to figuring out when you are on the last page is
to add a text box with an expression that uses the Pages
property (e.g. Page & " of " & Pages). Then the code for
the page **header** would be:
Me.Section(4).Visible = (Me.Page <> Me.Pages)
 
M

Marshall Barton

Ian said:
Many thanks Marshall - that sorted it out! It's a bit of a howler that we
have to go through such a routine to do something that is surely a basic
requirement of invoice design. There we go..

One last thing, how can I make the report footer stay at the bottom of the
page?


It's always the one last little thing that takes all the
work :-(

The Report Footer prints immediately after the last detail,
it's the Page Footer that prints at the bottom of the page.
If you can arrange it, you should use the page footer to
display the data in the (invisible) report footer by making
the usual page footer controls invisible and another set of
controls visible on the last page.

An alternative trick in A2002 or later is to set the last
detail's Height such that the report footer is pushed down
to the bottom of the page. To determine when you are
processing the last detail, add a hidden text box named
txtTotLines with the expression =Count(*) to the report
header section. Also add a hidden text box named txtLine to
the detail section. Set its expression to =1 and RunningSum
to Over All. Then the Detail section's Format event would
be something like:

If Me.txtLine = Me.txtTotLines Then
Me.Section(0).Height = (<page height less bottom margin> _
- Me.Section(2).Height) - Me.Top
End If

Because of the Pages two pass issue, you may need to reset
the detail's Height in the report header.
 
G

Guest

Hi Marshall,

Back to the original problem I'm afraid. We have multiple pages showing
totals on the natural last page - that is fine. However, what happens now is
that one-page Invoices are now printing two pages. The detail appears on the
first page and the totals on the next page. This should of course be only
one page. Any ideas?

Thanks
Ian
 
M

Marshall Barton

I am not ignoring this question, but I am having trouble
finding time to dig into the various interactions that have
come into play. I think(?) I have reproduced the situation,
but have not found the combination that unlocks the mystery.

I probably should comment on your little rant about features
to support invoices. Placing the totals at the bottom of
the page is only a consequence of using preprinted paper
forms. In the world of computers, it has no relevance to
the content of the invoice except for "that's the way we've
always done it" considerations.
 
M

Marshall Barton

I give up! Everything I try leads me in circles. I could
swear that I got something like this to work in A97, but
that was 7 or 8 years ago and it's now clear to me that it
can't work in A2003.

Maybe my previous attempts bailed out with the old standby
of duplicating the report footer controls in the page footer
and using Page=Pages to conditionally make one set of
controls visible and the other set invisible. It's a mess
to work in a section with two sets of controls on top of
each other, but at least it doesn't require the convolutions
we've been fooling around with on this unworkable other way.
 

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