Reports

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

Hi All,

I am really struggling with this one. I have 5 different
reports in Access that always have different number of
pages in each report. I want report 2 to start from the
page after report 1 ends and report 3 to start from the
page after report 2 ends and report 4 to start after
report 3 and so on
e.g If report 1 is page 1-15 then report 2 start on page
17 (the new report to always start with odd number page)
page 16 left blank intentionally.
and if report 2 starts from page 17 to 20 then report 3
to pickup from page 21 and so on.
Last to capture all the starting page number on table of
content page.
And at the end create one pdf document with all 5 reports
combine(I don't mind manualy if not possible to automize)
 
How do you start these reports? manually one by one, or clicking a single
button on a form and then one report starts printing (or outputting)
followed by next report printing (outputting) automatically? I assume the
latter and also you know how to code in VBA. Here is my thought.

1. Besides the 5 reports, create another report as content page. Also create
a ContentPage table which content page report will query on. The table has
two fields: reportname and pageCount (or lastPageNumber).

2. In each report's VBA code module, you write code in following event
handler
a. In Report_Open, query CountPage table for previous report's
pageCount(or lastPageNumber) to determine this report's start page. Of
course you do not need to do this with the first report.
b. In PageFooter_Format (or PageFooter_Print) event handler, use
Report.Page property and the start page number obtained above to calculate
current page number and print it in page footer.
c. In Report_Close event handler, get the total page count of current
report (Report.Pages property) and update to ContentPage table

3. When last report being printed/outputted, open (print/output the content
page report)

Hope this gives you an idea, and I believe someone have better way than
this.
 
Back
Top