Re: Using the IsError Function
- From: <david@epsomdotcomdotau>
- Date: Sat, 2 Feb 2008 19:22:48 +1100
1) You can sum a null value. That is not exactly what is giving you #Error.
On a report, [Amount] may refer to a control. A missing control
may give you #Error. A control may be missing if a section is missing:
a section may be missing if there is no data. I normally used code
to hide the summary values if data was missing. The way you have
done it seems to work satisfactorily.
2) You can't use IsError in a query, because IsError reports a
property of a VBA/OLE Variant type values. Queries have values
which are not VBA/OLE Variants, so they can never be IsError.
Even if you have an expression in a query, it is never copied to a
variant, so the VBA function IsError never returns a meaningful
result. If you get a #Error in a query, there is nothing you can
do to hide or mask it. You always have to create an expression
that avoids the #Error.
3) The VBA IIF is slightly different from the Jet SQL IIF.
The VBA IIF always evaluates both branches of the IIF statement.
The Jet SQL IIF only ever evaluates one branch of the IIF.
(david)
"Michael" <Michael@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D7E48572-7409-47C3-95FE-DF750A52D257@xxxxxxxxxxxxxxxx
Hello All.other
I am designing some reports for my boss, and he would like them to be a
little cleaner. For example, one report has a list of items and then a
sumation of the cost (=sum([Amount]). If there happens to be no items
present, the report shows "#Error" because you cannot sum a null value.
I was able to resolve this by using:
=IIf(IsNull([Amount]), "No Data", sum([Amount])
However, I would like to have a more comprehensive approach (to use on
errors that may occur). Something like the following:the
=IIf(IsError(<exp1>), "No Data", <exp1>)
i.e.
=IIf(IsError(sum([Amount]), "No Data", sum([Amount]))
This formula still gives me the "#Error" value. I believe this is due to
IsError function examining the expression, not the returned value of thesimilar?
expression.
Is there anyway to force access to evaluate the expression first, to make
sure it reviews the value not the expression? For example,
=IIf(IsError(evaluate(sum([Amount]))), "No Data" ....... or somthing
Any assistance you could provide would be greatly appreciated.
Thanks!
Michael
.
- References:
- Using the IsError Function
- From: Michael
- Using the IsError Function
- Prev by Date: Re: IIF Divide
- Next by Date: Re: Word wrap doesn't always work properly
- Previous by thread: Re: Using the IsError Function
- Next by thread: Re: How can I force all fields to grow to the largest "can grow" s
- Index(es):
Relevant Pages
|