PDA

View Full Version : calculated field



eran3185
05-15-2007, 11:48 PM
hey
i have 2 tables : big one - deals table , and small one - bookkeeping .
every deal has many records of bookkeeping .
in the bookkeeping table , i have this fields : date , credit , debit and balance.
i want that in the form , the balance will take the former balance+credit-debit
how can i do this thing in a simple way ?

geekgirlau
05-16-2007, 12:17 AM
You don't actually incorporate the "Balance" field in the calculation - in fact you don't really need a "Balance" field at all, as your forms and reports can use this calculation to obtain the balance.

=IIf(IsNull([Date]),0,nz(DSum("[Credit]","BookKeeping",
"[Date]<=#" & Format([Date],"mm/dd/yyyy") & "#"),0) -
nz(DSum("[Debit]","BookKeeping",
"[Date]<=#" & Format([Date],"mm/dd/yyyy") & "#"),0))