Hi,
The following code seems to work fine. The only problem is that the balance for each recorded transaction is related to the immediately previous one (previous row in the subform) and not the one being recorded so that all balances are offset by just one recording. Any Idea for getting the correct running balance?
The following code seems to work fine. The only problem is that the balance for each recorded transaction is related to the immediately previous one (previous row in the subform) and not the one being recorded so that all balances are offset by just one recording. Any Idea for getting the correct running balance?
Code:
Private Sub DomesticInv_AfterUpdate()
Dim Sum1 As Single
Dim Sum2 As Single
Dim CstId As Single
Dim stCriteria
CstId = Forms!F_Ledger!IDTblCustomers
Sum1 = Nz(DSum("DomesticInv", "TblLedger", "CstName=" & CstId), 0)
Sum2 = Nz(DSum("ForeignInv", "TblLedger", "CstName=" & CstId), 0)
Forms![F_Ledger]![SF_Ledger].Form![Balance].Value = Sum1 + Sum2
End Sub
Comment