Solved

Help with #Num!  error on a report

Posted on 2001-07-02
8
265 Views
Last Modified: 2012-05-04
When I use a calculated field on a report and it is dividing a number by zero, it produces an error #Num! in the field on the report.
Is there a way to have it produce the answer whenever it is legit, but replace the #Num! with 0 or anything I decide.
I was thinking maybe IIF ?

Thanks

Bill
0
Comment
Question by:bmeehan
  • 5
  • 2
8 Comments
 
LVL 12

Expert Comment

by:Paurths
Comment Utility
here is an example of that:

field3: IIf([field2]=0;"0";[field1]/[field2])

cheers
Ricky
0
 
LVL 8

Expert Comment

by:dovholuk
Comment Utility
paurths is on the money (not sure about those semi-colons though?)

i would change it around a bit to accept NULL values as well. such as:

CalculatedField : IIF(Nz(AFieldThatCouldBeZero,0) = 0, 'INF', SomeOtherField / AFieldThatCouldBeZero)

just adding to paurths comment...

dovholuk
0
 

Author Comment

by:bmeehan
Comment Utility
I tried this:
=IIf([SumOfmay margin]/[SumOfmay amt]=0," ",[SumOfmay margin]/[SumOfmay amt])

and the answer is either the correct amt or I get a #Num!

I notice it is when both margin and amt = 0
Could it have something like division by 0 is not allowed?

Bill
0
 
LVL 12

Accepted Solution

by:
Paurths earned 50 total points
Comment Utility
=IIf([SumOfmay amt]=0," ",[SumOfmay margin]/[SumOfmay amt])
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 12

Expert Comment

by:Paurths
Comment Utility
u checked the division in the iif statement to a 0 value.
if sumofmay amt is yet zero then u have #num result, so it is not 0 and the true part of the iif statement is not shown. Only the false.
0
 
LVL 12

Expert Comment

by:Paurths
Comment Utility
btw, exactly, division by zero can not be processed.
0
 
LVL 12

Expert Comment

by:Paurths
Comment Utility
or checking for null values also (dovholuk)
=IIf(Nz([sumOfMay amt];0)=0;" ";[SumOfMay margin]/[SumOfMay amt])
0
 

Author Comment

by:bmeehan
Comment Utility
That's it!

Thanks for the help.

Bill
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now