Forum Discussion
#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?
- Tony2021Steel Contributorwhere it says #error I need it to return $0
- Ken_SheridanBrass 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?
- Tony2021Steel Contributor
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
- Tony2021Steel Contributorthank 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!