HI Marlan and Ilkhoutx,
Sorry, it is Sum() not SumOf. This is a report so the code runs in the format.
I used code to Sum the controls of the Detail section that were populated with code. I am having difficulty with the other controls as described below.
Here's the code I am using to populate the Unbound text box:
Public Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim db As DAO.Database
Dim rs1 As DAO.Recordset
Dim rsPPS As DAO.Recordset
Dim strSQL1 As String
Set db = CurrentDb
'To Calculate Finance Fees based on custom inputs -SP 11-30-14
Dim cTemp As Currency 'Temp variable to calculate Finance Fees
Dim finfee As Currency 'Temp variable to calculate Finance Fees
Set rsPPS = fDAOGenericRst("qryProfitPerSaleByMonth2")
finfee = 0
If rsPPS.EOF Then
finfee = 0
End If
'Calculate Finance Fees
cTemp = 0
strSQL1 = "SELECT * FROM tblProfitPerSaleCust WHERE CatID = 1"
Set rs1 = db.OpenRecordset(strSQL1)
Do While Not rs1.EOF
cTemp = rsPPS(rs1("CustomField")).Value
cTemp = (cTemp * rs1("Multiple"))
If rs1("Add/Subtract") = "-" Then
finfee = finfee - cTemp
Else
finfee = finfee + cTemp
End If
rs1.MoveNext
Loop
rs1.Close
Me.FinanceFees = finfee
finfeeTot = finfeeTot + finfee
db.Close
Set db = Nothing
End Sub
Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
Me.SumOfFinanceFees = finfeeTot
finfeeTot = 0
End Sub
*****************
So, I have some other text boxes in the same Detail section that use the Me.FinanceFees code data results to add, i.e. "=[FinanceFees]-[OtherCosts]" as the Control Source.
It is these controls that I would like to Sum in the Footer section.
Any suggestions?
Cheers!
Steve