I
Ian Baker
Hi
I am curious to hear what others think would be the most efficient way to
sum some values given that in Access (2000, 2002 & 2003) there are many ways
to achieve the same result.
I have a main form with a subform that is bound to a hard query. The main
form (as a continous form) contains records for each bank account and the
subform contains the transactions on the currently selected bank account
record.
Amongst other fields each subform record has:
ctlDr - a calculated field in the underlying query showing the debit on a
bank account
ctlCr - a calculated field in the underlying query showing the credit on a
bank account
ctlCleared - a checkbox field that the user clicks to indicate the payment
has cleared
*The reason for the calculated fields is that if say the value in a
CreditAmount field is negative then display the amount as a positive value
in the Dr field and vice-versa (as this is needed when a transaction has
been reversed)
The main form contains 7 fields:
ctlOpeningBalance - derived from the underlying bank account record
ctlPresDr - a calculated text box that is to show a total amount of ctlDr if
ctlCleared=true
ctlPresCr - a calculated text box that is to show a total amount of ctlCr if
ctlCleared=true
ctlBalance - a calculated text box of
[ctlOpenBalance]-[ctlPresDr]+[ctlPresCr]
ctlUnpresDebits - a calculated text box that is to show a total amount of
ctlDr if ctlCleared=false
ctlUnpresCredits - a calculated text box that is to show a total amount of
ctlCr if ctlCleared=false
ctlEndBal - a calculated text box of
[ctlBalance]+[ctlUnpresDebits]-[ctlUnpresCredits]
I need to create a way that will update each of the main form calculated
fields each time: ctlCleared changes in a subform record
A subform record is deleted
A subform record is added (bank fees, reversals etc)
When the main form record changes
So of the many ways to achieve this which is the most efficient way i.e. a
hard query with totals and code doing a lookup each time, using
RecordsetClone in code, the fields using a DSum() etc. (Note the tables are
attached from a backend)
Your thoughts and examples are greatly appreciated.
I am curious to hear what others think would be the most efficient way to
sum some values given that in Access (2000, 2002 & 2003) there are many ways
to achieve the same result.
I have a main form with a subform that is bound to a hard query. The main
form (as a continous form) contains records for each bank account and the
subform contains the transactions on the currently selected bank account
record.
Amongst other fields each subform record has:
ctlDr - a calculated field in the underlying query showing the debit on a
bank account
ctlCr - a calculated field in the underlying query showing the credit on a
bank account
ctlCleared - a checkbox field that the user clicks to indicate the payment
has cleared
*The reason for the calculated fields is that if say the value in a
CreditAmount field is negative then display the amount as a positive value
in the Dr field and vice-versa (as this is needed when a transaction has
been reversed)
The main form contains 7 fields:
ctlOpeningBalance - derived from the underlying bank account record
ctlPresDr - a calculated text box that is to show a total amount of ctlDr if
ctlCleared=true
ctlPresCr - a calculated text box that is to show a total amount of ctlCr if
ctlCleared=true
ctlBalance - a calculated text box of
[ctlOpenBalance]-[ctlPresDr]+[ctlPresCr]
ctlUnpresDebits - a calculated text box that is to show a total amount of
ctlDr if ctlCleared=false
ctlUnpresCredits - a calculated text box that is to show a total amount of
ctlCr if ctlCleared=false
ctlEndBal - a calculated text box of
[ctlBalance]+[ctlUnpresDebits]-[ctlUnpresCredits]
I need to create a way that will update each of the main form calculated
fields each time: ctlCleared changes in a subform record
A subform record is deleted
A subform record is added (bank fees, reversals etc)
When the main form record changes
So of the many ways to achieve this which is the most efficient way i.e. a
hard query with totals and code doing a lookup each time, using
RecordsetClone in code, the fields using a DSum() etc. (Note the tables are
attached from a backend)
Your thoughts and examples are greatly appreciated.