A
AG
Using Access 2003.
Two tables.
tblBank - BankID (autonumber PK), PersonId (Long integer), MonthDate
(DateTime), DepositAmt (currency)
MonthDate is always first of month. Unique index PersonID, MonthDate.
tblExpenses - ExpID (autonumber PK), BankID (Long Integer), ExpAmt
(Currency).
One to many relationship tblBank.BankID on tblExpenses.BankID
Each month a DepositAmt is entered.
If the (prior balance + DepositAmt) >= Sum(ExpAmt for that month), then
new balance = (prior balance + DepositAmt) - Sum(ExpAmt for that month)
otherwise, the new balance is zero.
The new balance becomes the prior balance for the following month.
Any remaining ExpAmt is NOT carried over to the following month.
I need to be able to get the current balance and the total ExpAmt applied
for any month.
I can only think of two ways to do this.
Add another field to tblBank to store the prior balance (recalculating when
data changes)
or
copy all the necessary data into a temp table and walk through all the
records, recalculating every time I need to get the balance.
Both methods have their drawbacks with data integrity and performance.
Can anyone else offer another suggestion?
Thanks in advance for any help.
Two tables.
tblBank - BankID (autonumber PK), PersonId (Long integer), MonthDate
(DateTime), DepositAmt (currency)
MonthDate is always first of month. Unique index PersonID, MonthDate.
tblExpenses - ExpID (autonumber PK), BankID (Long Integer), ExpAmt
(Currency).
One to many relationship tblBank.BankID on tblExpenses.BankID
Each month a DepositAmt is entered.
If the (prior balance + DepositAmt) >= Sum(ExpAmt for that month), then
new balance = (prior balance + DepositAmt) - Sum(ExpAmt for that month)
otherwise, the new balance is zero.
The new balance becomes the prior balance for the following month.
Any remaining ExpAmt is NOT carried over to the following month.
I need to be able to get the current balance and the total ExpAmt applied
for any month.
I can only think of two ways to do this.
Add another field to tblBank to store the prior balance (recalculating when
data changes)
or
copy all the necessary data into a temp table and walk through all the
records, recalculating every time I need to get the balance.
Both methods have their drawbacks with data integrity and performance.
Can anyone else offer another suggestion?
Thanks in advance for any help.