On my report, each record has two values I want to sum up. They are Quantity and Accrued Interest. I set up an unbound text box called Total that correctly sums up these two values. All this is done in the detail section of the report. Now, I want to set up a running sum of all the Total fields into another unbound text box called CusipTotal. CusipTotal is in a different section footer than the detail. My problem is, with my code, the calculated field for CusipTotal is only giving me the final sum (quantity + accrued interest), not the sum of all of them.
Here is my code:
Code:
Option Compare Database
Dim gbl_CusipTotal As Double
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim dblTotal As Double
dblTotal = 0
dblTotal = Me.Quantity + Me.[Accrued Interest]
Me.Total = dblTotal 'Display Total for current record.
gbl_CusipTotal = gbl_CusipToal + dblTotal 'Add totals from all records for group
End Sub
Private Sub CusipFooter_Print(Cancel As Integer, PrintCount As Integer)
Me.CusipTotal = gbl_CusipTotal
gbl_CusipTotal = 0
End Sub
I set up a watch and used Step Into to try and debug it. Every time Detail_Print is executed, the value of gbl_CusipTotal is reset to nothing. Any help?
Thanks
Mark