how can i make a query with a running Total not using the Dsum?
Dim mySum as long.
mySum = DSum("myColumn", "myTable")
Select allOpen in new window
Dim sql As String
sql = vbNullString
sql = sql & "SELECT Sum(myColumn) As mySum" & vbCrLf
sql = sql & "FROM MyTable;"
Dim db As DAO.Database
Set db = CurrentDb
Dim rs As DAO.Recordset
Set rs = db.OpenRecordset(sql, dbOpenSnapshot)
Dim mySum As Long
mySum = rs("mySum")
Also can i make it from a query or it has to be from a table.
(Select Sum(Amount) From [Orders] As T
Where T.Id = [Orders].Id And T.Date <= [Orders].Date) As TotalAmount
© 1996-2022 Experts Exchange, LLC. All rights reserved. Covered by US Patent