Forum Discussion

Tony2021's avatar
Tony2021
Steel Contributor
Sep 18, 2024

#Error in output (need a handler)

Experts, how would I handle a #error output for some of the records? 

 

the below doesnt work since records still have #error: 

CurrAmount: IIf(IsNull([CurrAmt]),0,[CurrAmt])

 

thank you.  Let me know if not clear.  

 

my query looks like this:

 

 

  • Rather than calling the IIf function you can call the Nz function to return a value in place of a Null:

     

    CurrAmount:Nz(CurrAmt,0)

     

    With currency values, however, it is usually appropriate to set the DefaultValue property of a column to zero in a table definition, or, in the case of a computed column, return a zero in a query's result table. Null is the absence of a value and semantically ambiguous, e.g. what would a Null at the CreditLimit column in a Customers table mean?

    • Tony2021's avatar
      Tony2021
      Steel Contributor

      Tony2021 

      I have developed the following but I now need to return a $0 for the blank rows.
      CurrAmount: IIf(IsError(Nz([CurrAmt],0)),0,Nz([CurrAmt],0))

      do you see where I am wrong?  

       

  • Ken_Sheridan's avatar
    Ken_Sheridan
    Brass Contributor

    Rather than calling the IIf function you can call the Nz function to return a value in place of a Null:

     

    CurrAmount:Nz(CurrAmt,0)

     

    With currency values, however, it is usually appropriate to set the DefaultValue property of a column to zero in a table definition, or, in the case of a computed column, return a zero in a query's result table. Null is the absence of a value and semantically ambiguous, e.g. what would a Null at the CreditLimit column in a Customers table mean?

    • Tony2021's avatar
      Tony2021
      Steel Contributor

      Ken_Sheridan 

      HI Ken.  thanks for the response.  

      I actually did try the using Nz as you posted but unfortunately it still returns a #error.  

      The value is calculated rather than a field in a table (good pt on the default value)

       

      I can eliminate the #error at the form level with this:

      =IIf(IsError([CurrAmount]),0,[CurrAmount])  but if I put same at the query level then it returns #error.

      I would like to eliminate the #error at the query level.  

       

      do you happen to have another idea?   thank you

       

    • Tony2021's avatar
      Tony2021
      Steel Contributor
      thank you. I had to take a different approach and once I did I could use your suggestion. It looks good now. Glad to get that done. thank you!

Resources