P
(PeteCresswell)
I've got a table of transactions in which a running sum is kept for performance
reasons.
i.e.
tblTrade.SharesNetBalance = Net Of All Trades (buys/sells) for a given tranche.
Users want to be able to delete trades (instead of just entering an opposing
trade of the same amount).
This means that, when a trade is deleted, I need to recompute all those net
balances.
Started writing a lot of VBA code to determine the last trade before the deleted
one, iterate through the table computing running sums on the fly and so-forth.
Then I recalled some SQL that somebody gave me that computed a relative line
number in the result set. Sounds like a running sum to me....
So, can I concoct an Update query that will iterate though a recordset and
compute a running sum? Seems like that might be faster - given the nature of
SQL - even though we'd be doing all records for a given tranche instead of a
subset based on the deleted trade.
reasons.
i.e.
tblTrade.SharesNetBalance = Net Of All Trades (buys/sells) for a given tranche.
Users want to be able to delete trades (instead of just entering an opposing
trade of the same amount).
This means that, when a trade is deleted, I need to recompute all those net
balances.
Started writing a lot of VBA code to determine the last trade before the deleted
one, iterate through the table computing running sums on the fly and so-forth.
Then I recalled some SQL that somebody gave me that computed a relative line
number in the result set. Sounds like a running sum to me....
So, can I concoct an Update query that will iterate though a recordset and
compute a running sum? Seems like that might be faster - given the nature of
SQL - even though we'd be doing all records for a given tranche instead of a
subset based on the deleted trade.