Hide Main Report Page Footer on Subreport pages

J

JudyT

Okay. I have a report which contains a subreport in a group footer section,
so that the Main Report is like a summary and then there is a page break in
the group footer section then the subreport starts on the next page and
contains details. Then the you have another main report page, then more
detail subreport pages, etc.

My problem is I have a Page Footer on my Main Report and I only want it to
show on the Main Report "summary pages" not the Subreport "detail pages". I
need the info as a page footer so it puts it at the bottom of the page.

Thank you in advance for your help
 
M

Marshall Barton

JudyT said:
Okay. I have a report which contains a subreport in a group footer section,
so that the Main Report is like a summary and then there is a page break in
the group footer section then the subreport starts on the next page and
contains details. Then the you have another main report page, then more
detail subreport pages, etc.

My problem is I have a Page Footer on my Main Report and I only want it to
show on the Main Report "summary pages" not the Subreport "detail pages". I
need the info as a page footer so it puts it at the bottom of the page.


The subreport's Open event procedure can hide the main
report's page footer:
Parent.Section(4).Visible = False

You can use the main report group header section to make it
visible again:
Me.Section(4).Visible = True
 
J

JudyT

Marshall, Thanks for your help but that didn't work. I am getting an macro
error message. Not sure why but can we try something else.

Thanks for your help in advance.
Judy
 
M

Marshall Barton

Couple of things to try:

1) Jump up and down and scream at the computer ;-)

2) Explain what "doesn't work" means in terms of what
actually happened along with the exact error message.

When you mentioned a "macro error" I get worried, because
what I posted has nothing to do with macros.
 
J

JudyT

Marsh,

#1 didn't work, so I will give you the info needed for #2.

I typed:

1) Parent.Section(4).Visible = False in the Subreport's On Open... Event

2) Me.Section(4).Visible = True in the Main Report's Group Header (which is
called CC Header in my report) On Print... Event

I chose the On Print Event Procedure on the Main Report because I was not
really sure where to put it - I hope this was the correct place.

When I try to run the report I recevie the following two errors:

Microsoft Office Access can't find the macro 'Parent'
The macro (or its macro group) doesn't exist, or the macro is new but hasn't
been saved.
Note that when you enter the macrogroupname.macroname syntax in an argument,
you must specify the name the macro's macro group was last saved under.

Microsoft Office Access can't find the macro 'Me'
The macro (or its macro group) doesn't exist, or the macro is new but hasn't
been saved.
Note that when you enter the macrogroupname.macroname syntax in an argument,
you must specify the name the macro's macro group was last saved under.

I am then taken back to the report's design view.

Also, I'm not sure if this is relevant or not but I am running this databse
though a Citrix environment.

Thanks for your help,
Judy


Marshall Barton said:
Couple of things to try:

1) Jump up and down and scream at the computer ;-)

2) Explain what "doesn't work" means in terms of what
actually happened along with the exact error message.

When you mentioned a "macro error" I get worried, because
what I posted has nothing to do with macros.
--
Marsh
MVP [MS Access]

Marshall, Thanks for your help but that didn't work. I am getting an macro
error message. Not sure why but can we try something else.
 
M

Marshall Barton

JudyT said:
#1 didn't work, so I will give you the info needed for #2.

Might have been worth a try even if it just vented some
frustration ;-)
I typed:

1) Parent.Section(4).Visible = False in the Subreport's On Open... Event

2) Me.Section(4).Visible = True in the Main Report's Group Header (which is
called CC Header in my report) On Print... Event

I chose the On Print Event Procedure on the Main Report because I was not
really sure where to put it - I hope this was the correct place.


Ah Ha!

You typed the line of VBA code in the OnPrint property when
it needs to be in the Print event ***procedure***

To get to the event procedure, select
[Event Procedure]
in the OnPrint property.

Then click on the builder button [...] at the far right of
the property. That should take you to the event procedure
where you can enter the line of code between the Sub and End
Sub lines.
 
J

JudyT

Wow, it would really help if I knew what I was doing, huh!

Well, moving the two lines of code into the event procedure did get rid of
the error messages, and now the report runs; however, it's still not doing
what I need it to.

It now doesn't print the footer on any on the pages including the Main
Report. Am I putting the Me.Section(4).Visible = True Event Procedure into
the wrong place maybe?

I tried moving it to the Report Header's On Print instead of the Group
Header's On Print, but this did not work.

Thank you for you help, I feel like we are gettingreally close now.

Marshall Barton said:
JudyT said:
#1 didn't work, so I will give you the info needed for #2.

Might have been worth a try even if it just vented some
frustration ;-)
I typed:

1) Parent.Section(4).Visible = False in the Subreport's On Open... Event

2) Me.Section(4).Visible = True in the Main Report's Group Header (which is
called CC Header in my report) On Print... Event

I chose the On Print Event Procedure on the Main Report because I was not
really sure where to put it - I hope this was the correct place.


Ah Ha!

You typed the line of VBA code in the OnPrint property when
it needs to be in the Print event ***procedure***

To get to the event procedure, select
[Event Procedure]
in the OnPrint property.

Then click on the builder button [...] at the far right of
the property. That should take you to the event procedure
where you can enter the line of code between the Sub and End
Sub lines.
 
M

Marshall Barton

JudyT said:
Well, moving the two lines of code into the event procedure did get rid of
the error messages, and now the report runs; however, it's still not doing
what I need it to.

It now doesn't print the footer on any on the pages including the Main
Report. Am I putting the Me.Section(4).Visible = True Event Procedure into
the wrong place maybe?

I tried moving it to the Report Header's On Print instead of the Group
Header's On Print, but this did not work.

You might(?) need the line:
Me.Section(4).Visible = True
In the Report Header's Format (or Print) event procedure
too. However, I would expect that putting it just in the
group header's Format (or Print) event procedure would be
sufficient.

Try the Format event instead of the Print event.

If it still doesn't worl, post back with a Copy/Paste of the
code you have.
--
Marsh
MVP [MS Access]

 
J

JudyT

I tried the following Codes individually and together (Report Format with
Group Format and Report Print with Group Print). All gave me the same
results: The footer was removed from all pages.

When I take the Event Procedure off of the Subreport's On Open the report
footer does come back on all pages so I know it is the Subreport Event
Procedure that is removing it. I just can't get it to show back up on the
Main Report pages.

Private Sub GroupHeader6_Format(Cancel As Integer, FormatCount As Integer)
Me.Section(4).Visible = True
End Sub

Private Sub GroupHeader6_Print(Cancel As Integer, PrintCount As Integer)
Me.Section(4).Visible = True
End Sub

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
Me.Section(4).Visible = True
End Sub

Private Sub PageHeaderSection_Print(Cancel As Integer, PrintCount As Integer)
Me.Section(4).Visible = True
End Sub
 
M

Marshall Barton

JudyT said:
I tried the following Codes individually and together (Report Format with
Group Format and Report Print with Group Print). All gave me the same
results: The footer was removed from all pages.

When I take the Event Procedure off of the Subreport's On Open the report
footer does come back on all pages so I know it is the Subreport Event
Procedure that is removing it. I just can't get it to show back up on the
Main Report pages.

Private Sub GroupHeader6_Format(Cancel As Integer, FormatCount As Integer)
Me.Section(4).Visible = True
End Sub

Private Sub GroupHeader6_Print(Cancel As Integer, PrintCount As Integer)
Me.Section(4).Visible = True
End Sub

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
Me.Section(4).Visible = True
End Sub

Private Sub PageHeaderSection_Print(Cancel As Integer, PrintCount As Integer)
Me.Section(4).Visible = True
End Sub


Don't try to use both events. Determine the one that works
(usually the Format event) and use that one.

After a lot of testing, I'm finding that all this stuff is
significantly different than it was in A97. The subreport's
Open event is triggered before the main report's first page
header events!? The subreport's records seems to be
processed twice at arbitrary points?! Making the main
report's page footer visible appears to be ineffective most
everywhere except in the page header??

Let's try a different approach.

First, create another main report group (with footer) on the
same field as your existing group. Put the controls before
your page break in the inner group's footer and the
subreport in the outer group footer.

Get rid of the page break control and instead, set the outer
group footer's ForceNewPage property to Before Section.

In the main report's module, declare a variable named
SubRpt:
Public bolSubRpt As Boolean
at the top of the module, before any Sub and Function
declarations.

Then add this line of code to the main report's inner group
footer's Print event:
bolSubRpt = False
(If the subreport does not have the report footer section,
add it (View menu) and set its Height to zero.)

Add this line to the subreport's report footer's Print event
Parent.bolSubRpt = True

Finally, add this line to the main report's page header's
Format event:
Me.Section(4).Visible = bolSubRpt
 

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