expression - Account Balance For Invoice Purposes Access 2010 -


i have created new transactions table (tbltransactions) can log [debits] (i.e. invoices) , [credits] (i.e.payments). can run query an expression current account balance.

however, invoicing purposes, if pulled current account balance described above, wouldn't 'previous account balance' value want display customer on invoice, because it's showing value includes current invoice amount. want customer see previous balance prior to invoice.

my current solution uses expressions in query calculate 'previous account balance', don't know if done way. suggestions on how done better?

i couldn't post picture of query b/c don't have enough reputation points.

invoice fields i'm trying populate:

  • invoice amount
  • previous account balance (prior invoice)
  • final invoice amount

below calculations used in query

invoice amount: debit

previous account balance: format([account credits]-[account debits],"currency")

final invoice amount: format([invoice amount]-[previous account balance],"currency")

account debits: format(dsum("[debit]","tbltransactions","clientid =" & [clientid])-[debit],"currency") *this formula takes out value of current debit in query

account credits: format(dsum("[credit]","tbltransactions","clientid =" & [clientid]),"currency")

a solution "quick , dirty" find add condition query excluding record on working (current invoice). if have id, can add condition dsum, excluding current record. let's assume idtransact id field of tbltransactions, condition should

"clientid =" & [clientid] & "and idtransact <> " & cstr([idtransact])

i assumed id long (autonumbering).

hope can you. let me know.

bye


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -