A report's Grand Total (txtGrand below) displays correctly in Print Preview. However, it is incorrect when Printed.
The Detail field (txtMoney) is derived from a query (because the report is too complex for only one query). Therefore, the Grand Total is accumulated in code in the variable curTotal. The Grand Total on the report is set in the sub ReportFooter_Print.
Report layout:
Detail:
txtMoney (unbound)
Report Footer:
txtGrand (unbound)
Report Code:
Dim curTotal As Currency
Private Sub Detail_Print()
txtMoney = Nz(DLookup("Money", "QryName"), 0)
curTotal = curTotal + txtMoney 'Accumulate Grand Total.
End Sub
Private Sub ReportFooter_Print()
txtGrand = curTotal 'Move Grand Total to report.
End Sub
The Detail field (txtMoney) is derived from a query (because the report is too complex for only one query). Therefore, the Grand Total is accumulated in code in the variable curTotal. The Grand Total on the report is set in the sub ReportFooter_Print.
Report layout:
Detail:
txtMoney (unbound)
Report Footer:
txtGrand (unbound)
Report Code:
Dim curTotal As Currency
Private Sub Detail_Print()
txtMoney = Nz(DLookup("Money", "QryName"), 0)
curTotal = curTotal + txtMoney 'Accumulate Grand Total.
End Sub
Private Sub ReportFooter_Print()
txtGrand = curTotal 'Move Grand Total to report.
End Sub