Good Day All,
In VBA summing a field of a table or query is simple. However I cant figure out a way to sum a field of a record set.
I tried the following extract but to no avail:
I would be grateful for the solution to by problem:
In VBA summing a field of a table or query is simple. However I cant figure out a way to sum a field of a record set.
I tried the following extract but to no avail:
I would be grateful for the solution to by problem:
Code:
Private Sub Combo7_AfterUpdate()
Dim curDatabase As Database
Dim rst As Recordset
Dim strFilter As String
Dim FirstString As String
Set curDatabase = CurrentDb
FirstString = "SELECT [Account General Journal].*, MonthAndYearNames.ID" _
& " FROM MonthAndYearNames INNER JOIN [Account General Journal] ON MonthAndYearNames.MonthName = [Account General Journal].SpareType" _
& " WHERE [Account General Journal].ACType = 1013 AND MonthAndYearNames.ID <= " & strFilter
Set rst = curDatabase.OpenRecordset(FirstString)
rst.MoveLast
MsgBox DSum("Debit", "[rst]")
End Sub