Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I don't want to see #num! on my report can I mask it with '0' 1

Status
Not open for further replies.

mearmortal

Programmer
May 1, 2002
79
GB
I have a calculation which is (0/1234)*1000000 sometimes,
and it returns #num!
Is their a way of trapping this and substitute the returned value with '0'

Suggestions please
 
Check out the IIF function- this should do what you want.
 
I have an IIf function but whats the sytax for filtering the #num!?
 
Mmm, not as easy as I though then

OK, how about trying to capture the probelm earlier on? How about something like this in the AfterUpdate event of whatever control is causing the problem:

If IsNumeric (Me![NameofyourControl]) Then

Else
Me![NameofyourControl] = 0
End If

Seems to work on a quick test here....
 
I must say you suggestion about trying to trap things earlier paid off. I was not able to put the if then else onto the report but I changed the test argument I was using to look at one of the calculated fields from the query and test it for 0, after doing this it worked: -

=IIf(([SumofDefectQuantity])=0,0,([DPMOValue]/[SumofDPMOValue]))

This is the other calculated field: -

DPMOValue: ([SumofDefectQuantity]/([SumofKey]*[OFDNumber]))*1000000

Thanks for your help.

[2thumbsup]
 
FYI: you can trap the error using iserror() so that (0/1234)*1000000 becomes
=iif(iserror((0/1234)*1000000),0,(0/1234)*1000000)

Ben ----------------------------------
Ben O'Hara
bo104@westyorkshire.police.uk
----------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top