2015年4月25日 星期六

Access Report page break by Group and add blank page

This Access tutorial explains how to add page break by Group in Access Report and add blank page if last page is odd number.


Access Report page break by Group


When we create Access Report which has different grouping, we may want to start a new page for each group.


Assume that we have the following Report grouped by Department and Section. How do we start a new page for each Department?


access_report_page_break


First, go to the Design View of the Report. As you can see at the bottom, it is grouped by Department and then grouped by Section.


access_report_page_break_02


Click on Dept Header, in the Property page, set the Force New Page property to Before Section


access_report_page_break_03


Alternative, click on the Dept Footer, in the Property page, set the Force New Page property to After Section. Do not use After Section in Access 2010 because it is bugged to give blank pages, use Before Section instead.


Now go to Print Preview and you will see Access starts a new page for each Department.


access_report_page_break_04


access_report_page_break_05


Access Report add blank page if last page is odd number


If we are going to distribute each report to each department, we cannot have page 1 for department A and page 2 for department B, instead you can print single side.


To print double side, if the end page of department A is odd page, we need to insert a blank page, so that we have department A in page 1, blank page 2, department B in page 3.


Now go to Design View, under Dept Footer, insert a Page Break Control, say PageBreak49.


access_report_page_break_06


Next, click on Depart Footer, in the Property, select Event > On Format > Code Builder


access_report_page_break_07


Insert the following code


If Me.Page Mod 2 = 0 Then
    Me!PageBreak49.Visible = False
Else
    Me!PageBreak49.Visible = True
End If

Go to Print Preview. Now Finance Department are in Page 1 and 2. Since the last page is even number, PageBreak49 is invisible (no page break).


access_report_page_break_08


 


access_report_page_break_09


For HR Department, since the last page is odd number, PageBreak49 becomes visible (add page break).


access_report_page_break_10


access_report_page_break_11


Outbound References


https://support.office.com/en-us/article/Insert-a-page-break-control-in-an-Access-report-86D2EA7D-7AA6-44F2-8507-23134A9A2E15



Access Report page break by Group and add blank page

沒有留言:

張貼留言