IsError In Query - Handle #Error

G

gumby

ResponseRateI: Sum(Abs([StatusIr]="Objective Meet"))/Sum(Abs(Not
[StatusIr]="No Objective Required"))

Sometimes in my query I get a #Error message. Of course I know why, it
cannot divide by zero. I would like to handle this error buy placing a
1 in the field is the an #error is returned.

I have tried

IIf(IsError(Sum(Abs([StatusIr]="Objective Meet"))/Sum(Abs(Not
[StatusIr]="No Objective Required")),1,Sum(Abs([StatusIr]="Objective
Meet"))/Sum(Abs(Not [StatusIr]="No Objective Required")))

With no Luck.

Thanks,

David Isaacks
 
A

Allen Browne

You will probably find IIf() works better than IsError().

This kind of thing:

IIf(Abs(Sum([StatusIr] <>"No Objective Required")) <> 0,
Abs(Sum([StatusIr]="Objective Meet")) /
Abs(Sum([StatusIr] <>"No Objective Required")), 1)
 
G

gumby

You will probably find IIf() works better than IsError().

This kind of thing:

IIf(Abs(Sum([StatusIr] <>"No Objective Required")) <> 0,
Abs(Sum([StatusIr]="Objective Meet")) /
Abs(Sum([StatusIr] <>"No Objective Required")), 1)

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.




ResponseRateI: Sum(Abs([StatusIr]="Objective Meet"))/Sum(Abs(Not
[StatusIr]="No Objective Required"))
Sometimes in my query I get a #Error message. Of course I know why, it
cannot divide by zero. I would like to handle this error buy placing a
1 in the field is the an #error is returned.
I have tried
IIf(IsError(Sum(Abs([StatusIr]="Objective Meet"))/Sum(Abs(Not
[StatusIr]="No Objective Required")),1,Sum(Abs([StatusIr]="Objective
Meet"))/Sum(Abs(Not [StatusIr]="No Objective Required")))
With no Luck.

David Isaacks- Hide quoted text -

- Show quoted text -

Work great. Thanks - I can now see the difference.

David
 

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