Expression help continued

  • Thread starter Thread starter myxmaster
  • Start date Start date
M

myxmaster

I have the following expression:

=DSum("Amount", "YourTable", "TransactionType = ""Credit""") -
DSum("Amount", "YourTable", "TransactionType = ""Debit""")

However if there is NO Debit transaction the expression does not work.
What do I have to do to have it reflect all credits and IF there is a
Debit to adjust accordingly

TIA
 
If there are no debits, the second DSum function returns a Null value, which
then propagates through the mathematical calculation, resulting in a Null
value for the subtraction. Use the Nz function to replace the Null value
with a zero value:

=DSum("Amount", "YourTable", "TransactionType = ""Credit""") -
Nz(DSum("Amount", "YourTable", "TransactionType = ""Debit"""),0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top