how can i make a query with a running Total not using the Dsum?
Dim mySum as long.
mySum = DSum("myColumn", "myTable")
Open 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
Get your personalized solution.
Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.
*This site is protected by reCAPTCHA and the Google
Terms of Service apply.
Please enter a first name
Please enter a last name
8+ characters (letters, numbers, and a symbol)
Take hold of your future.