Check for #Error

N

Neil

1/0 = #Error

How do I check for this and represent it as 0 instead of #Error?

I tried IIf(IsError([Value1]/[Value2]),0,[Value1]/[Value2) and that did not
work.

As always, thanks so much in advance for the valuable suggestions. Thanks
You!
 
J

Jerry Whittle

You can trap the error or trap what causes the error. I would look for the
cause.

IIf([Value2]=0,0,[Value1]/[Value2)
 
N

Neil

Thanks for the tip. I added a criteria for only reporting [Value2]>0. Was
hoping there was a neat trick for testing #Error.

Thanks again!

Jerry Whittle said:
You can trap the error or trap what causes the error. I would look for the
cause.

IIf([Value2]=0,0,[Value1]/[Value2)
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


Neil said:
1/0 = #Error

How do I check for this and represent it as 0 instead of #Error?

I tried IIf(IsError([Value1]/[Value2]),0,[Value1]/[Value2) and that did not
work.

As always, thanks so much in advance for the valuable suggestions. Thanks
You!
 
A

aaron.kempf

SQL Server has 'try-catch' _IN_ SQL syntax.

-Aaron



Thanks for the tip.  I added a criteria for only reporting [Value2]>0.  Was
hoping there was  a neat trick for testing #Error.

Thanks again!



Jerry Whittle said:
You can trap the error or trap what causes the error. I would look for the
cause.
IIf([Value2]=0,0,[Value1]/[Value2)
1/0 = #Error
How do I check for this and represent it as 0 instead of #Error?
I tried IIf(IsError([Value1]/[Value2]),0,[Value1]/[Value2) and that did not
work.
As always, thanks so much in advance for the valuable suggestions.  Thanks
You!- Hide quoted text -

- Show quoted text -
 

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

Top