DSum?

Sergio_Moreira

New member
Local time
Today, 10:28
Joined
Oct 14, 2015
Messages
5
Dear all, good afternoon,

Apologies, can't seem to tackle this, I supose easy one, using DSum function on a query design grid (rookie as hell, no VBA whatsoever)...

Anyway, I've got this table [FIN-DB-cash-flow-data] where, amongst many other data fields, there is one [valor-liquido] I have to have on a running sum. This field is the value for each cash-flow movement recorded in the DB. It can either be posivite or negative (if cash-in or cash-out).

But I'd like to have the running sum for this. Seems like using a calculated column in a query design grid as Transporte: DSum([valor-liquido];[FIN-DB-cash-flow-data]) is not pulling it, it looks like it's just duplicating the value that's in the [valor-liquido] in each record, eg.: where [valor-liquido] is 500, it calculates 1000. The next record contains 600, and it puts 1200...

Any thoughts on how to have it right guys?

Say 1st record has 500, this [Transporte] should display 500
Then 2nd record has 600, this [Transporte] would then display 1100 (as 500+600)... and so on...

Any help will be kindly appreciated, best regards
 
put another field in your table, an autonumber field (ie, ID).
create this query:

SELECT *, (SELECT SUM([Transporte]) FROM [FIN-DB-cash-flow-data] AS T1 WHERE T1.ID <= [ID]) AS RunningSum from [FIN-DB-cash-flow-data]
 

Users who are viewing this thread

Back
Top Bottom