Calculated Control Refers to Multiple Reports

N

Nancy

I have five reports, which for formatting reasons cannot be combined into
one. They all open automatically with one command and need to be paginated as
if they are one report. The number of pages for each report will differ
depending on the data entered for each record. Pagination for each report
sums the total number of pages ([Pages]) for the previous reports.

The calculated control in the reports looks like this:

report name: Report 2
control name: NewPage
control source: =[Reports]![Report1]![Pages]+1

report name: Report 3
control name: NewPage
control source: =[Reports]![Report1]![Pages]+[Reports]![Report2]![Pages]+1

....etc.

The OnFormat code in each report is as follows:

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
If page = 1 Then page = Me.NewPage
End Sub

Works fine as long as all five reports have data. However, sometimes one of
the five reports has no data and does not open, in which case the pagination
for the next report will reset to 1, because the NewPage control has
generated the #NAME error. Any ideas on how to say "if the report is not
open, skip it". I've tried using Iif(IsError) without any luck. help?
Thanks!
 

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