Forum Discussion

Tony2021's avatar
Tony2021
Steel Contributor
Jun 02, 2022

Nz and Dsum

Experts,

 

How would I add Nz to the below AmendSum Dsum statement?  I think I need to add Nz if the "Amount" is null.  The amount is NULL in tblFXAmends where IDFXfk]= & [ID] (I did set the default value to 0 but there are a few records that are still NULL)

 

AmendSum: Format(DSum("Amount","tblFXAmends","[IDFXfk]=" & [ID]),"Standard")

 

this is my entire query:

SELECT tblBanks.BankID, tblFX2.Notional, Format(DSum("Amount","tblFXAmends","[IDFXfk]=" & [ID]),"Standard") AS AmendSum, Nz([Notional],0)+(DSum("Amount","tblFXAmends","[IDFXfk]=" & [ID])) AS GTotal
FROM tblFX2 INNER JOIN tblBanks ON tblFX2.Bank = tblBanks.BankID;

 

thank you

  • Just add Nz in the following concept
    Nz(Dsum("field","table","Criteria"),0)
  • tsgiannis's avatar
    tsgiannis
    Iron Contributor
    Just add Nz in the following concept
    Nz(Dsum("field","table","Criteria"),0)
    • Tony2021's avatar
      Tony2021
      Steel Contributor
      Perfect. I thought I tried that but I guess I made a mistake somewhere. anyways, it works. thank you

Resources