IsError Help

P

Patricia

I am trying to use the IsError function and I am doing something stupid and
cannot figure it out.
I have the following items in the query:

Expr1=0
Expr2=10
Expr3= [Expr2]/[Expr1]

Then when I do IsError([Expr3]) it returns #Error instead of true
What is wrong? Thanks
 
K

Klatuu

You need to reread the IsError topic in VBA Help. That is not how it works.
You are getting an error 11 "Divide by Zero". No computer ever built can do
that. It is a mathmatical impossibility. If you are checking to prevent
that, then there are some things to consider. What do you want to do if the
divisor is 0?
If Expr1 = 0 then
MsgBox "Zero Found"
End If

Sometimes, in the right circumstances, I have used this:

Expr3 = Expr2/IIf(Expr1 = 0, 1, Expr1)
 

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