Query with running total

Kobus-Dippenaar

Registered User.
Local time
Today, 23:11
Joined
Oct 10, 2014
Messages
50
Good day,
I have setup a test query ("Query1") whereby the query has to display a running total as long as the Department is the same.

The problem I am having is that I get a total of all records being displayed.

Appreciate the help,

Blessings
 

Attachments

DSum("[Amt]","[test]","[Dept] ='" & [Dept] & "' AND [Period] <='" & [Period] & "'")
 
The criteria of your DSum uses no variables:

"[Dept] =[Dept] AND [Period] <=[Period] "

For that second [Dept] and [Period] you need to use them as variables and have the data from that record put into the criteria string. You do that by escaping out of the string and concatenating the variable, getting back into the string, escaping out, placing the second variable's value and then finally getting back into the string to close it.

This is what your criteria should be:

"[Dept] ='" & [Dept] & "' AND [Period] <='" & [Period] & "'"
 

Users who are viewing this thread

Back
Top Bottom