DSUM / Running Sum In query

snodrift1

Registered User.
Local time
Today, 07:02
Joined
Sep 5, 2006
Messages
15
I have been trying to get this all night. This was my last attempt. I know it is all wrong and messed up but after 10 hrs I go for help. There is no date field to work with.

Expr2: DSum("[Amount]","
  • ","[Item]=" & [Item] & "and [FinItem]>0")+0

    But it ended up like this.

    Item ------Location-------Amount--Expr2----Expr3
    210090------030005 -------267470--error ---- 859103.74417
    220170------ GYM -------409000-- error ----859103.74417
    220170------ 060010-------83297 ---error ----859103.74417
    220170------ 050010-------17762 -- error ----859103.74417
    3429B -------060010------- 0.74417--error ----859103.74417
    3429B -------060010------- 3 ---- error ----859103.74417
    7342900-----060010--------5369 --- error ----859103.74417
    7342900-----060050--------76202 -- error ----859103.74417


    I need it to look like this.Where it will do a running sum based on the "Item" Groups.

    Item---------Location------Amount----Expr2------Expr3
    210090------ 030005-------267470-- -267470---859103.74417
    220170------ GYM -------- 409000-- -409000---859103.74417
    220170------060010------- 83297--- -492297---859103.74417
    220170------050010------- 17762--- -510059---859103.74417
    3429B-------060010------- 0.74417---0.74417---859103.74417
    3429B-------060010------- 3-------3.74417---859103.74417
    7342900-----060010------- 5369---- 5369-----859103.74417
    7342900-----060050------- 76202--- 81571----859103.74417





    Please Help.
 
You might try a query something like this :

SELECT Yourtable.item, Yourtable.location, Sum(Yourtable.amount) AS SumOfamount
FROM Yourtable
GROUP BY Yourtable.item, Yourtable.location;


Hth
 
I tried that and since there is another column that has to be there I end up with the same result. So it did not work.
 
OK, you might try this :

SELECT Yourtable.item, Yourtable.location, Sum(Yourtable.amount) AS SumOfamount, DSum("[amount]","Yourtable","") AS Exp3
FROM Yourtable
GROUP BY Yourtable.item, Yourtable.location;


Hth
 

Users who are viewing this thread

Back
Top Bottom