Hiding page header and footer on a specific page (1 Viewer)

Padwan

Registered User.
Local time
Today, 01:47
Joined
Jan 17, 2012
Messages
28
Hi I am ran into a snag on one my of reports. I have a batch report packet by record that I do on a daily basis. The problem I have is one of the reports in the packet will not print dual sided properly. The report in question has 3 pages leaving the back of the third page blank. When I printed the said report it printed all the records in order the way I liked but it attached the first page of the next record on the back of the previous records 3rd page :eek:. So the first thing I did was extended out the footer section just enough so it would add a fourth page. That worked but now I have the header and footer on it which I want to hide. The following is the portion of code that works for hiding the header on the first page of each record. This is fine I want it to do that but what I need it to do is in addition to that is to hide the header and footer on the fourth page of each record for that specific report. it currently works for 3 pages I need it to encompass 4 pages now. It's probably an easy fix but since I am not that well expirenced with vba I need another set of eyes on this. Thanks in advance :)

Private Sub Report_Page()
If Me.Page Mod 3 = 0 Then
Me.PageHeaderSection.Visible = False
Me.PageFooterSection.Visible = True
Else
Me.PageHeaderSection.Visible = True
Me.PageFooterSection.Visible = True
End If
End Sub
 

vbaInet

AWF VIP
Local time
Today, 09:47
Joined
Jan 22, 2010
Messages
26,374
So basically you want that particular report to print even number of pages?
 

boblarson

Smeghead
Local time
Today, 01:47
Joined
Jan 12, 2001
Messages
32,059
Also, your code should go in the Format event of the particular section.
 

Padwan

Registered User.
Local time
Today, 01:47
Joined
Jan 17, 2012
Messages
28
@vbaInet No I want it to be on all pages except for the fourth I want nothing on it and i want the header not to appaear on the first page of each records report . and @boblarson I will move it to the format event thanks.
 

cthode

New member
Local time
Today, 10:47
Joined
Oct 26, 2010
Messages
3
Just remember about the format event:

This event is not fired when laying out a section for display on the screen.​
Format

is fired only when Access is preparing to interact with a printer driver. In other​
words, it does not fire in Report view or Layout view.
 

boblarson

Smeghead
Local time
Today, 01:47
Joined
Jan 12, 2001
Messages
32,059
Just remember about the format event:

This event is not fired when laying out a section for display on the screen.​
Format

is fired only when Access is preparing to interact with a printer driver. In other​
words, it does not fire in Report view or Layout view.
However, that advice needs to be clarified as it does not apply directly to versions of 2003 and prior. Access 2007 was the first with Report view and Layout view and layout view is not a presentation view so that should only really be used when designing the report. And the Report View would need the code to be put on the ON PAINT event (of the applicable section) as well as the ON FORMAT event (of the applicable section) which would mean you should create a procedure to do it and then call it from both places.
 

cthode

New member
Local time
Today, 10:47
Joined
Oct 26, 2010
Messages
3
Hi Bob
Thanks for your comments. After upgrading from 2003 to 2010, Onform event gave me problems until I read this brief remark in "Microsoft ® Access ® 2010 Programmer's Reference."

Christian
 

Users who are viewing this thread

Top Bottom