Running Sum Issue

Posted on 2016-10-06
Last Modified: 2016-10-07
Hello experts,

I am trying have running sum based on category but I keep getting overall running sum. I attached a photo for reference. Tool number is text. ShiftEnd is date. Output is number. Please help.
Question by:Kai Lee
  • 4
  • 2
LVL 35

Accepted Solution

PatHartman earned 250 total points
ID: 41832157
What is "category"?  It isn't in the query.  If you want to restrict the DSum() add additional criteria.

Running sums should almost never be calculated in queries.  The process in Access is very expensive.  Do it in your report.  Reports are liniar and so calculating a running sum presents no problem.  If you need the report to break on something, add sorting and grouping and choose "over group" rather than "over all" for the running sum.
LVL 92

Assisted Solution

by:Patrick Matthews
Patrick Matthews earned 250 total points
ID: 41832184
I assume that "by category" you mean "running sum by [Tool Number] and [ShiftEnd]".  If so, the short answer is that both conditions have to specified in your DSum criteria.

That said, PatHartman is 100% correct: using domain aggregates in a query like this is almost always a bad idea, and should be avoided.  Doing this in  a report is fairly trivial.  If you must have this do this in a query, I would do it as a self-join.

Author Comment

by:Kai Lee
ID: 41832202
Thank you all for answering my question. "By category" I mean running sum by [Tool Number] and [ShiftEnd]. I used report for running sum but it still showed overall running sum when I chose "over group".
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.


Author Comment

by:Kai Lee
ID: 41832218
Hello I attached another pic that shows what result what am I getting. Sorry I can't show the data. Capture.PNG
LVL 35

Assisted Solution

PatHartman earned 250 total points
ID: 41832225
You have to group by Tool in the report.  Then the running sum will be for just that tool.

In your dsum, the criteria was >= tool.  It needs to be >= ShiftID and = tool

Author Comment

by:Kai Lee
ID: 41833577
Hello Pat,

After changing to Rtotal: DSum("[Output_Tools/Shift]","[Shifts]","[Tool Number]='" & [Tool Number] & "'" And "[ShiftID]>= " & [ShiftID]) see the result

Author Comment

by:Kai Lee
ID: 41833579
I will try to use report again

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Use a Combo-Box to do a Search 26 24
Access 2016 7 33
Run report based on combo box selection - access 2007 2 18
object variable or with block not set 6 26
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now