D
Dennis
Is there anyway to prevent my totals from messing-up
whenever the totals occur after a page break?
Here is the code that I'm using:
Option Compare Database
'
**********************************************************
' Creating Global variables
'
**********************************************************
Public SourceTotalAwarded As Currency
Public SourceTotalRequested As Currency
Public YearTotalRequested As Currency
Public YearTotalAwarded As Currency
Public GrandTotalRequested As Currency
Public GrandTotalAwarded As Currency
**********************************************************
' Year Footer
'
' Action:
' Accumulating Grand Totals from Yearly Totals
' Assigning Year Totals tp Year Totals fields
' Reseting Yearly Totals to zero
'
**********************************************************
Private Sub GroupFooter1_Format(Cancel As Integer,
FormatCount As Integer)
GrandTotalRequested = GrandTotalRequested +
YearTotalRequested
GrandTotalAwarded = GrandTotalAwarded +
YearTotalAwarded
[Year_Total_Requested] = YearTotalRequested
[Year_Total_Awarded] = YearTotalAwarded
End Sub
**********************************************************
' Year Header
'
' Action:
' Reset Year Totals to zero
'
**********************************************************
Private Sub GroupHeader0_Format(Cancel As Integer,
FormatCount As Integer)
YearTotalAwarded = 0
YearTotalRequested = 0
End Sub
'
**********************************************************
' BUNumber Header
'
' Action:
' Calculate Source Totals
'
**********************************************************
Private Sub GroupHeader1_Format(Cancel As Integer,
FormatCount As Integer)
If [Total_Amount_Awarded] > 0 Then
SourceTotalAwarded = SourceTotalAwarded +
[Total_Amount_Awarded]
End If
If [Total_Amount_Requested] > 0 Then
SourceTotalRequested = SourceTotalRequested +
[Total_Amount_Requested]
End If
End Sub
' ********************************************************
' Open Report
'
' Action:
' Set all variables to zero
'
**********************************************************
Private Sub Report_Open(Cancel As Integer)
SourceTotalAwarded = 0
SourceTotalRequested = 0
YearTotalRequested = 0
YearTotalAwarded = 0
GrandTotalRequested = 0
GrandTotalAwarded = 0
End Sub
'
**********************************************************
' Report Footer
'
' Action:
' Assigning Grand Totals to Gand Totals fields
'
'*********************************************************
Private Sub ReportFooter_Format(Cancel As Integer,
FormatCount As Integer)
[Grand_Total_Requested] = GrandTotalRequested
[Grand_Total_Awarded] = GrandTotalAwarded
End Sub
Private Sub ReportHeader_Format(Cancel As Integer,
FormatCount As Integer)
SourceTotalAwarded = 0
SourceTotalRequested = 0
YearTotalRequested = 0
YearTotalAwarded = 0
GrandTotalRequested = 0
GrandTotalAwarded = 0
End Sub
'
**********************************************************
' Source Footer
'
' Action:
' Assign Source Totals to Source Total fields
' Accumulats Yearly Totals from Source Totals
' Reset Source Totals to zero
'
*********************************************************
Private Sub SourceFooter_Print(Cancel As Integer,
PrintCount As Integer)
[Source_Total_Amount_Awarded] = SourceTotalAwarded
YearTotalAwarded = YearTotalAwarded +
[Source_Total_Amount_Awarded]
[Source_Total_Amount_Requested] = SourceTotalRequested
YearTotalRequested = YearTotalRequested +
[Source_Total_Amount_Requested]
SourceTotalAwarded = 0
SourceTotalRequested = 0
End Sub
whenever the totals occur after a page break?
Here is the code that I'm using:
Option Compare Database
'
**********************************************************
' Creating Global variables
'
**********************************************************
Public SourceTotalAwarded As Currency
Public SourceTotalRequested As Currency
Public YearTotalRequested As Currency
Public YearTotalAwarded As Currency
Public GrandTotalRequested As Currency
Public GrandTotalAwarded As Currency
**********************************************************
' Year Footer
'
' Action:
' Accumulating Grand Totals from Yearly Totals
' Assigning Year Totals tp Year Totals fields
' Reseting Yearly Totals to zero
'
**********************************************************
Private Sub GroupFooter1_Format(Cancel As Integer,
FormatCount As Integer)
GrandTotalRequested = GrandTotalRequested +
YearTotalRequested
GrandTotalAwarded = GrandTotalAwarded +
YearTotalAwarded
[Year_Total_Requested] = YearTotalRequested
[Year_Total_Awarded] = YearTotalAwarded
End Sub
**********************************************************
' Year Header
'
' Action:
' Reset Year Totals to zero
'
**********************************************************
Private Sub GroupHeader0_Format(Cancel As Integer,
FormatCount As Integer)
YearTotalAwarded = 0
YearTotalRequested = 0
End Sub
'
**********************************************************
' BUNumber Header
'
' Action:
' Calculate Source Totals
'
**********************************************************
Private Sub GroupHeader1_Format(Cancel As Integer,
FormatCount As Integer)
If [Total_Amount_Awarded] > 0 Then
SourceTotalAwarded = SourceTotalAwarded +
[Total_Amount_Awarded]
End If
If [Total_Amount_Requested] > 0 Then
SourceTotalRequested = SourceTotalRequested +
[Total_Amount_Requested]
End If
End Sub
' ********************************************************
' Open Report
'
' Action:
' Set all variables to zero
'
**********************************************************
Private Sub Report_Open(Cancel As Integer)
SourceTotalAwarded = 0
SourceTotalRequested = 0
YearTotalRequested = 0
YearTotalAwarded = 0
GrandTotalRequested = 0
GrandTotalAwarded = 0
End Sub
'
**********************************************************
' Report Footer
'
' Action:
' Assigning Grand Totals to Gand Totals fields
'
'*********************************************************
Private Sub ReportFooter_Format(Cancel As Integer,
FormatCount As Integer)
[Grand_Total_Requested] = GrandTotalRequested
[Grand_Total_Awarded] = GrandTotalAwarded
End Sub
Private Sub ReportHeader_Format(Cancel As Integer,
FormatCount As Integer)
SourceTotalAwarded = 0
SourceTotalRequested = 0
YearTotalRequested = 0
YearTotalAwarded = 0
GrandTotalRequested = 0
GrandTotalAwarded = 0
End Sub
'
**********************************************************
' Source Footer
'
' Action:
' Assign Source Totals to Source Total fields
' Accumulats Yearly Totals from Source Totals
' Reset Source Totals to zero
'
*********************************************************
Private Sub SourceFooter_Print(Cancel As Integer,
PrintCount As Integer)
[Source_Total_Amount_Awarded] = SourceTotalAwarded
YearTotalAwarded = YearTotalAwarded +
[Source_Total_Amount_Awarded]
[Source_Total_Amount_Requested] = SourceTotalRequested
YearTotalRequested = YearTotalRequested +
[Source_Total_Amount_Requested]
SourceTotalAwarded = 0
SourceTotalRequested = 0
End Sub