conditionally suppress page header & footers (1 Viewer)

Tupacmoche

Registered User.
Local time
Yesterday, 23:29
Joined
Apr 28, 2008
Messages
291
Hi Report Masters,

I have a report that appropriately prints its headers and footers for the main report. But, I also have Page Breaks controls in this report with sub reports that I don't want to have the page header or footer of the main report printed on. To suppress the header/footers, I have added this code to the page Header/footer Sections - On Format event:

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)
If Me.SPH_MEDTrustee.Value = 1 Then
Forms!Report_Gift_Transmittal_Rpt.Section(acPageHeader).Visible = False
Else
End If
End Sub

I know that the above condition is correct since it is also the condition for the sub report being included and it is. Can anyone see what is wrong?:confused:
 

GinaWhipp

AWF VIP
Local time
Yesterday, 23:29
Joined
Jun 21, 2011
Messages
5,899
Have tried to also set the Page Header Height to 0?
 

Tupacmoche

Registered User.
Local time
Yesterday, 23:29
Joined
Apr 28, 2008
Messages
291
Just tried it with no change.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 04:29
Joined
Feb 19, 2013
Messages
16,653
perhaps try

me.PageHeaderSection.DisplayWhen=0

not sure which value, you can experiment - the only options are Always, screen only and print only
 

GinaWhipp

AWF VIP
Local time
Yesterday, 23:29
Joined
Jun 21, 2011
Messages
5,899
Can you please post what you tried because I have used this frequently with no issues.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 04:29
Joined
Feb 19, 2013
Messages
16,653
@Gina - just curious - can you set a report section height to 0 if there are controls in it? In a form, it would reduce the height to the bottom of the lowest control
 

GinaWhipp

AWF VIP
Local time
Yesterday, 23:29
Joined
Jun 21, 2011
Messages
5,899
@CJ_London,

You do also have to set the controls to 0. My bad for not mentioning that! :eek:
 

CJ_London

Super Moderator
Staff member
Local time
Today, 04:29
Joined
Feb 19, 2013
Messages
16,653
ahh - presumable both top and height?
 

GinaWhipp

AWF VIP
Local time
Yesterday, 23:29
Joined
Jun 21, 2011
Messages
5,899
I just set the Height to 0 but the object is *banked* at the top, so if not then yes, you would need to use Top.
 

Tupacmoche

Registered User.
Local time
Yesterday, 23:29
Joined
Apr 28, 2008
Messages
291
Just to make sure that I'm not making a stupid blunder, the code to suppress goes in the main report's header and footer on format section and not in the same section of the sub report correct? :eek:
 

GinaWhipp

AWF VIP
Local time
Yesterday, 23:29
Joined
Jun 21, 2011
Messages
5,899
Hmm, just to make sure I understand... what is getting shrunk, main report or subreport?
 

Tupacmoche

Registered User.
Local time
Yesterday, 23:29
Joined
Apr 28, 2008
Messages
291
The main report should always have the page header and footer. When the page break starts a new page and the sub report prints it should not have either page/footer that appear on the main report.
 

GinaWhipp

AWF VIP
Local time
Yesterday, 23:29
Joined
Jun 21, 2011
Messages
5,899
Then it goes on the subreport though I am not sure I have done a subreport before. In theory it should work, if it doesn't may need a trigger from the main
 

Tupacmoche

Registered User.
Local time
Yesterday, 23:29
Joined
Apr 28, 2008
Messages
291
The sub report only has a detail band so what would be suppressed?
 

Tupacmoche

Registered User.
Local time
Yesterday, 23:29
Joined
Apr 28, 2008
Messages
291
I have the sub reports in the detail band should they be moved into a different band of the report that can resolve this?
 

GinaWhipp

AWF VIP
Local time
Yesterday, 23:29
Joined
Jun 21, 2011
Messages
5,899
:rolleyes: I must need more coffee... then of course the Main report!
 

Tupacmoche

Registered User.
Local time
Yesterday, 23:29
Joined
Apr 28, 2008
Messages
291
Hi GinaWhipp,

I have added this vba code to the reports on format: Reports!Gift_Rpt.Section(acPageHeader).Visible = False

I did the same for the footer. So, now I'm not getting header or footers any where. How can I limit this condition to the subreports and have the header/footer appear on the main report only?
 

GinaWhipp

AWF VIP
Local time
Yesterday, 23:29
Joined
Jun 21, 2011
Messages
5,899
Do you mean limit for the pages that have the Subreports? Because you said the Subreports only have a detail section.
 

Tupacmoche

Registered User.
Local time
Yesterday, 23:29
Joined
Apr 28, 2008
Messages
291
Yes, the sub reports only have a Detail band but they are in the detail band of the main report proceeded by a page break control. So, the code : Reports!Gift_Rpt.Section(acPageHeader).Visible = False is suppressing the page header/footers every where including the main report. Is there a way to filter the suppression to the sub reports so that the main report will have page headers/footers?:mad: See attachment.
 

Attachments

  • Report with subreports.jpg
    Report with subreports.jpg
    99.1 KB · Views: 72

GinaWhipp

AWF VIP
Local time
Yesterday, 23:29
Joined
Jun 21, 2011
Messages
5,899
Okay, well that is little trickier. Do you have pages numbers? Because you could try saying *If page 2 then don't show...*
 

Users who are viewing this thread

Top Bottom