I've been trying to get a cumulative total by month for expenses for the last few days and I just can't get it to work. Here is the code for the query
Code:
SELECT DISTINCTROW Format(DatePart("m",[InvoiceDate]),"00") & " - " & Format(DatePart("yyyy",[InvoiceDate]),"0000") AS Expr1, Expenses.[Expense Type], Sum(Expenses.Amount) AS [Sum Of Amount], (DSum("Amount","Expenses","[Expenses].[Expense Type] <=" & [Expenses].[Expense Type])) AS [Running Total]
FROM Expenses
GROUP BY Format(DatePart("m",[InvoiceDate]),"00") & " - " & Format(DatePart("yyyy",[InvoiceDate]),"0000"), Expenses.[Expense Type]
HAVING (((Format(DatePart("m",[InvoiceDate]),"00") & " - " & Format(DatePart("yyyy",[InvoiceDate]),"0000")) Not Like "?-?"))
ORDER BY Format(DatePart("m",[InvoiceDate]),"00") & " - " & Format(DatePart("yyyy",[InvoiceDate]),"0000"), Expenses.[Expense Type];
It's this line that won't give in
Code:
(DSum("Amount","Expenses","[Expenses].[Expense Type] <=" & [Expenses].[Expense Type])) AS [Running Total]
Anyone able to help?
I can PM someone the db if necessary