Hi,
I can't figure out what I am doing wrong here. The ICounter part works, but the MySum part sums the same exact number, not the aggregate of the records for that field. I would be grateful for any help.
I can't figure out what I am doing wrong here. The ICounter part works, but the MySum part sums the same exact number, not the aggregate of the records for that field. I would be grateful for any help.
Code:
Dim MyRecordset As DAO.Recordset
Set MyRecordset = Me.RecordsetClone
Dim i As Long, iCounter As Long
Dim MySum As Long
Rem START AT FIRST RECORD
MyRecordset.MoveFirst
Do Until MyRecordset.EOF
If MyRecordset![Building NO] = Me.Building_NO Then
iCounter = iCounter + 1
MySum = MySum + Me.Order_Amount
End If
MyRecordset.MoveNext
Loop