Access 2003 Report rptWhiteMailDeposit
I have found the "four lines of code" solution to adding sums to page
footers and it is working...mostly. (if report is only one page long it
doesn't count. Over two pages it works.)
In the rptWhiteMailDeposit I would like to have in the PAGE FOOTER of
each page the following:
Total Brought Forward (from previous page of report when report is
longer than 1 page)
Page Total (txtPageCashSum + txtPageChecksSum)
Grand Total (only displayed on last page of report. Sum of Page totals
to that point)
I've tried several things and inevitably the total brought forward on
page 2,3 etc. gets reset to zero when the pageheader print function
resets txtPageCashSum. A global variable solution perhaps? I can only
find a vague reference to a solution that used to work with Access
2000.
Here is the code I'm using. Any help would be appreciated. I am head of
non profit (The Salvation Army )in Covington, VA
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
txtPageCashSum = txtPageCashSum + txtDonorCashAmmount
txtPageCheckSum = txtPageCheckSum + txtDonorCheckAmmount
End Sub
Private Sub PageHeaderSection_Print(Cancel As Integer, PrintCount As
Integer)
txtPageCashSum = 0
txtPageCheckSum = 0
End Sub
FYI: May be effcting things:
Code for filter form that alters the content of this report on the fly:
Private Sub cboDateDonationEntered_MouseDown(Button As Integer, Shift
As Integer, X As Single, Y As Single)
ocxCalendar1.Visible = True
ocxCalendar1.SetFocus
If Not IsNull(cboDateDonationEntered) Then
ocxCalendar1.Value = cboDateDonationEntered.Value
Else
ocxCalendar1.Value = Date
End If
End Sub
Private Sub cmdApplyFilter_Click()
Dim strDonationDate As String
Dim strCampaign As String
Dim strFilter As String
If SysCmd(acSysCmdGetObjectState, acReport, "rptWhiteMailDeposit") <>
acObjStateOpen Then
DoCmd.OpenReport "rptWhiteMailDeposit", acViewPreview
End If
txtPageCashSum = 0
txtPageCheckSum = 0
If IsNull(Me.cboDateDonationEntered.Value) Then
strDonationDate = "Like '*'"
Else
strDonationDate = "=#" & Me.cboDateDonationEntered.Value & "#"
End If
If IsNull(Me.cboCampaign.Value) Then
strCampaign = "Like '*'"
Else
strCampaign = "='" & Me.cboCampaign.Value & "'"
End If
strFilter = "[SystemInputDate] " & strDonationDate & " AND
[DonorCampaign] " & strCampaign
With Reports![rptWhiteMailDeposit]
.Filter = strFilter
.FilterOn = True
.txtReportTitle.Value = "Name of Appeal: " &
Me.cboCampaign.Value
.txtReportRunDate.Value = "Date: " &
Me.cboDateDonationEntered.Value
End With
End Sub
Private Sub cmdCancel_Click()
DoCmd.Close acForm, "deposit report"
End Sub
Private Sub cmdRemoveFilter_Click()
On Error Resume Next
Reports![rptWhiteMailDeposit].FilterOn = False
End Sub
Private Sub ocxCalendar1_Click()
cboDateDonationEntered.Value = ocxCalendar1.Value
cboDateDonationEntered.SetFocus
ocxCalendar1.Visible = False
End Sub