Hide Main report Page Footer If subreport spans multiple pages?

  • Thread starter Alexcamp via AccessMonster.com
  • Start date
A

Alexcamp via AccessMonster.com

I have a report that displays invoices for given customers. The report is
grouped by customer.

Sometimes the invoice details (subreport) spans across a second page. I have
got all headers & page footers to repeat on that second page so this works
fine. What I want is to hide the Main Reports Page footer if the Subreport is
spanning on a second page. Hide it on the first page (for that group only)
and display it only on the last page (usually the second page... but hey.. it
could even be the third!).

I CANNOT use the [page] and [pages] event because sometimes the report prints
multiple invoices for different customers (such as when the invoices batch
are created) and sometimes it prints a single invoice only.

If I were to only print a single invoice I would simply use: IF [page]<[Pages]
then me.section(pagefooter).visible = false

But since I print multiple invoices, the customer with a "2 page invoice" can
be right in the middle of a 10 invoices report.


Does anyone have any ideas ?
 
M

Marshall Barton

Alexcamp said:
I have a report that displays invoices for given customers. The report is
grouped by customer.

Sometimes the invoice details (subreport) spans across a second page. I have
got all headers & page footers to repeat on that second page so this works
fine. What I want is to hide the Main Reports Page footer if the Subreport is
spanning on a second page. Hide it on the first page (for that group only)
and display it only on the last page (usually the second page... but hey.. it
could even be the third!).

I CANNOT use the [page] and [pages] event because sometimes the report prints
multiple invoices for different customers (such as when the invoices batch
are created) and sometimes it prints a single invoice only.

If I were to only print a single invoice I would simply use: IF [page]<[Pages]
then me.section(pagefooter).visible = false

But since I print multiple invoices, the customer with a "2 page invoice" can
be right in the middle of a 10 invoices report.

A new one for me ;-)

I tried this and it seemed to work. Add a hidden text box
(named txtFtr) to the group header section. Add a line of
code to the group header section's Print event:
Me.txtFtr = True
and add a line of code to the group footer section's Print
event:
Me.txtFtr = False

Then add a line of code to the page footer section's Format
event:
Cancel = True

Note that it would require severe restricitions on the
report (and a different approach) to be able to use the page
footer space for details on all but the last page of a
group. The code in the page header section's Format event
would have to be able to predict how much space the
remaining details and the group footer will require
(CanGrow/CanShrink both set to No might(?) be sufficient).
 
A

Alexcamp via AccessMonster.com

Marshall, I dont understand how "Cancel = true" is related to txtFtr... ?

what is the function of txtFtr besides displaying true/false ?

Didn't you mean Cancel = txtFtr ?


Marshall said:
I have a report that displays invoices for given customers. The report is
grouped by customer.
[quoted text clipped - 15 lines]
But since I print multiple invoices, the customer with a "2 page invoice" can
be right in the middle of a 10 invoices report.

A new one for me ;-)

I tried this and it seemed to work. Add a hidden text box
(named txtFtr) to the group header section. Add a line of
code to the group header section's Print event:
Me.txtFtr = True
and add a line of code to the group footer section's Print
event:
Me.txtFtr = False

Then add a line of code to the page footer section's Format
event:
Cancel = True

Note that it would require severe restricitions on the
report (and a different approach) to be able to use the page
footer space for details on all but the last page of a
group. The code in the page header section's Format event
would have to be able to predict how much space the
remaining details and the group footer will require
(CanGrow/CanShrink both set to No might(?) be sufficient).
 
M

Marshall Barton

Yes, that's what I meant. Sorry about causing the
confusion.
--
Marsh
MVP [MS Access]

Marshall, I dont understand how "Cancel = true" is related to txtFtr... ?

what is the function of txtFtr besides displaying true/false ?

Didn't you mean Cancel = txtFtr ?


Marshall said:
I have a report that displays invoices for given customers. The report is
grouped by customer.
[quoted text clipped - 15 lines]
But since I print multiple invoices, the customer with a "2 page invoice" can
be right in the middle of a 10 invoices report.

A new one for me ;-)

I tried this and it seemed to work. Add a hidden text box
(named txtFtr) to the group header section. Add a line of
code to the group header section's Print event:
Me.txtFtr = True
and add a line of code to the group footer section's Print
event:
Me.txtFtr = False

Then add a line of code to the page footer section's Format
event:
Cancel = True

Note that it would require severe restricitions on the
report (and a different approach) to be able to use the page
footer space for details on all but the last page of a
group. The code in the page header section's Format event
would have to be able to predict how much space the
remaining details and the group footer will require
(CanGrow/CanShrink both set to No might(?) be sufficient).
 
A

Alexcamp via AccessMonster.com

Marshall you're a genius!

I was able to use the method to hide/show my subtotals and display a
"Continued on next page" message instead.

Thanks a lot it is much appreciated !!
 
A

Alexcamp via AccessMonster.com

Marshall, I have another question.

Using the same examples, I would like to display "continued from previous
page" on the Group Header of the Second page (or any subsequent pages) of an
invoice.

So far I haven't got any success as the textbox in the group header is
formatted before the group footer. I tried to use txtcontinued.visible =
false in the Page footer format code by without success. The textbox just
won't hide on single page invoices and on the first page of a multiple-page
invoice...

Any ideas ?

Thanks

Alex
 
M

Marshall Barton

Alexcamp said:
Marshall, I have another question.

Using the same examples, I would like to display "continued from previous
page" on the Group Header of the Second page (or any subsequent pages) of an
invoice.


The way I do this is to add a detail counter text box (named
txtLineNum) to the detail section, Set its control source
expression to =1 ans RunningSum property to Over Group.

Then the txtcontinued text box in the group header can be
made visible/invisible using a line of code in the header
section Format event procedure:

txtcontinued.visible = (Me.txtLineNum > 1)

The idea is that the only time txtcontinued should not be
displayed is when it preceeds the first detail. There is a
chance that the group header could appear at the bottom of a
page where there is no room for the first detail so the
header will appear again at the top of the next page without
displaying txtcontinued. To prevent that kind of thing, I
always either use the header section's ForceNewPage property
or I set the **group** KeepTogether property to With First
Detail.
 

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