I'm setting a report footer's visible property based on records in the detail section of the report. The code works when the report is run separately but not when it's run from the main report.
The report is a form letter used for price quotes.
Main Report Page Header Section
Contractor, Address, "We are pleased to quote..."
Main Report Detail Section
Sub-report which contains products and prices
Main Report Footer Section
The rest of the letter
The sub-report footer section contains a footnote about "Product X". When "Product X" is included in the price quote for the contractor, the footer is visible, otherwise it's not.
Here's how the sub-report works:
I have an unbound control in the sub-report footer.
On the sub-report ReportHeader_Print event I set unbound control = false. As the sub-report detail lines are printed, if "Product X" is included, the unbound control is changed to true. On the sub-report ReportFooter_Format event I set section(acFooter).visible = unbound control.
When I run the sub-report as part of the main report I get an invalid use of null on that line. I've deleted the ReportFooter_Format procedure and checked the value of the unbound control at the end of the ReportHeader and ReportDetail print events and the value is true or false. Could it be that the sub-report ReportFooter_Format event is triggered before the events in the sub-report?
The report is a form letter used for price quotes.
Main Report Page Header Section
Contractor, Address, "We are pleased to quote..."
Main Report Detail Section
Sub-report which contains products and prices
Main Report Footer Section
The rest of the letter
The sub-report footer section contains a footnote about "Product X". When "Product X" is included in the price quote for the contractor, the footer is visible, otherwise it's not.
Here's how the sub-report works:
I have an unbound control in the sub-report footer.
On the sub-report ReportHeader_Print event I set unbound control = false. As the sub-report detail lines are printed, if "Product X" is included, the unbound control is changed to true. On the sub-report ReportFooter_Format event I set section(acFooter).visible = unbound control.
When I run the sub-report as part of the main report I get an invalid use of null on that line. I've deleted the ReportFooter_Format procedure and checked the value of the unbound control at the end of the ReportHeader and ReportDetail print events and the value is true or false. Could it be that the sub-report ReportFooter_Format event is triggered before the events in the sub-report?