[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 496
  • Last Modified:

Access 07 - Cumul Sum field in a Query - Time to process concern

Hello all,

Well I've posted questions in the past trying to get a query to add a cumulative sum field within a query.

Cap1 always can do this in 1 query.... It takes me 3 queries to get to the same result but at least I was able to FINALLY get there.

I'm attaching a db only has 4 tables and the 3 queries.  The 4 tables have maybe 50 total records.

The ultimate result that I need is what is in qry_CumulSum_step3 but to get there I had to do qry_CumulSum first then qry_CumulSum_step2.

My concern here is when I open qry_CumulSum_step3 it takes too long for there only being 31 records.

So.... what will happen when I have 5,000 or 10,000 records...........

Any suggestions to speed this process up would be appreciated.

My code for the step3 query is
SELECT qry_CumulSum_Step2.ShiftID, qry_CumulSum_Step2.BusDay, qry_CumulSum_Step2.CashFdActID, qry_CumulSum_Step2.TransAmtTtl, Val(DSum("TransAmtTtl","qry_CumulSum_Step2","ShiftID <=" & [a].[ShiftID])) AS y
FROM qry_CumulSum_Step2 INNER JOIN qry_CumulSum_Step2 AS a ON (qry_CumulSum_Step2.BusDay = a.BusDay) AND (qry_CumulSum_Step2.ShiftID = a.ShiftID);

Open in new window

EE-Cumulative-Sum-Q.accdb
0
wlwebb
Asked:
wlwebb
  • 2
1 Solution
 
als315Commented:
You can increase calculation speed if you remove dsum from first query. I don't understand why you need it there. Dsum always take a lot of time, try to use it only in last step
0
 
wlwebbAuthor Commented:
It was where I started.......  I just tried to get it to do a cumulative sum on anything... I was grasping at straws at that point ;-((   I should have removed it I agree...  

When I did your suggestion it did in fact increase query step 3....

Thank you Als!!!
0
 
als315Commented:
Look at this sample with 2 queries also
EE-Cumulative-Sum-Q1.accdb
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now