I have created an Access Database to store information from my various bank
accounts and keep track of my finances.
Everything works great, except that I decided not to keep the balance data
on the sheet, only the transaction amount.
I figured it was easier to just add all the previous transaction amounts to
get the balance on any given date (and a single balance adjustment at the
start of the data).
I am regretting this choice now as the code I have created to do it takes
ages......
Does anybody have any bright ideas on how I could do it? (I have included
my code below for an example)
----------------------------------------------------------------------------
--
SELECT [Q:Data].TransDate, Sum([Q:Data].[TransAmount]*-1)
AS Amount, -1*
(SELECT SUM([TransAmount])
FROM [Q:Data] as [Q:Data_1]
WHERE [Q:Data_1].[TransDate] <= [Q:Data].[TransDate]
and [Q:Data_1].[Account]=[Q:Data].[Account])
AS Balance, [Q:Data].Account
FROM [Q:Data]
GROUP BY [Q:Data].TransDate, [Q:Data].Account;
(I then crosstab the returned data so I can chart it)
accounts and keep track of my finances.
Everything works great, except that I decided not to keep the balance data
on the sheet, only the transaction amount.
I figured it was easier to just add all the previous transaction amounts to
get the balance on any given date (and a single balance adjustment at the
start of the data).
I am regretting this choice now as the code I have created to do it takes
ages......
Does anybody have any bright ideas on how I could do it? (I have included
my code below for an example)
----------------------------------------------------------------------------
--
SELECT [Q:Data].TransDate, Sum([Q:Data].[TransAmount]*-1)
AS Amount, -1*
(SELECT SUM([TransAmount])
FROM [Q:Data] as [Q:Data_1]
WHERE [Q:Data_1].[TransDate] <= [Q:Data].[TransDate]
and [Q:Data_1].[Account]=[Q:Data].[Account])
AS Balance, [Q:Data].Account
FROM [Q:Data]
GROUP BY [Q:Data].TransDate, [Q:Data].Account;
(I then crosstab the returned data so I can chart it)
Comment