Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Div0 Error
Marius Steenkamp 
    
5 years ago
HI
I am getting a #Div/)! Error in one og my calc,s. The does not happen everytime as my inputs differ but when i get this error i would like access to retun a 0 value. Does any one have a Fix.

Thanks

Marius
Marius Steenkamp OP  @Reply  
    
5 years ago
For example if my calc divides 1 by 0
Kevin Robertson  @Reply  
          
5 years ago
Result: IIf([SecondNumber]=0,0,[FirstNumber]/[SecondNumber])

IIF Function
Marius Steenkamp OP  @Reply  
    
5 years ago
IIf([Qty]= 0,0,[Answer1]/Qty]) This is what my calc looks like. I am getting the following error on this.

THE EXPRESSION YOU ENTERED HAS AN INVALID NUMBER.

Looks like it is finding a problem with the 0 numbers.
Kevin Robertson  @Reply  
          
5 years ago
You are missing a square bracket on the second Qty
IIf([Qty]= 0,0,[Answer1]/Qty]) should be
IIf([Qty]= 0,0,[Answer1]/[Qty])
Marius Steenkamp OP  @Reply  
    
5 years ago
Sorry. I have corrected that but still get the same message.
IIf ( [Qty]= 0 ,0 , [Answer1] / [Qty] )
Kevin Robertson  @Reply  
          
5 years ago
Where are you using the function?
Is it in a Query?
Can you post some screenshots please?
Alex Hedley  @Reply  
           
5 years ago
What data types are Qty and Answer1?
Marius Steenkamp OP  @Reply  
    
5 years ago

Marius Steenkamp OP  @Reply  
    
5 years ago

Marius Steenkamp OP  @Reply  
    
5 years ago
The data type of Qty is number and Answer1 are a expression
Scott Axton  @Reply  
        
4 years ago
If you are using & in a field name it is probably being miss interpreted by Access.
If the Width and Bleed are being added together you should be using a +

The general rule for field names is only use letters and numbers.  I know that you can use some other characters like the underscore  _  but it could be mistaken too easily.
Marius Steenkamp OP  @Reply  
    
4 years ago
Thank you Scott. I will change it. It still does not fix the problem.
Scott Axton  @Reply  
        
4 years ago
So which was it?  Poor field name or adding the fields together?
What is your new equation?  

Remember your Order of Operation (PEMDAS).
Marius Steenkamp OP  @Reply  
    
4 years ago
The original problem is still not solved. I am still getting a #Div/0! error.
Marius Steenkamp OP  @Reply  
    
4 years ago

Marius Steenkamp OP  @Reply  
    
4 years ago

Marius Steenkamp OP  @Reply  
    
4 years ago

Scott Axton  @Reply  
        
4 years ago
Try writing it like this:

   IIF([Answer2] <> 0, [Qty]/[Answer2], 0)
Marius Steenkamp OP  @Reply  
    
4 years ago
I have tried the argument on the TechHelp template. I used the QuoteDetailQ and i am getting the same problem. I am using Office 365.
Marius Steenkamp OP  @Reply  
    
4 years ago

Marius Steenkamp OP  @Reply  
    
4 years ago

Adam Schwanz  @Reply  
           
4 years ago
What is Answer2?  Maybe I missed it, but I see Answer1 is a calculation, is Answer2? Your problem might be happening before you even get to the point of trying to do a calculation with Answer2.
Adam Schwanz  @Reply  
           
4 years ago
Ah I see the query now, it is a calculation. I cant see the calculation but I can see Answer1, try making it like this in your answer 2

Answer1: IIF([Width&Bleed]=0,0,Int([PrintableWidth]/[Width&Bleed]))

Then move onto OptionB
Alex Hedley  @Reply  
           
4 years ago
Can we see the Table design for DigitalCalcT?
Alex Hedley  @Reply  
           
4 years ago
Also try hardcoding each of the values, only swapping out one at a time, to see if any work, then it might narrow down which Field is causing the problem.
Richard Rost  @Reply  
          
4 years ago
The problem is probably caused by the fact that Access needs to evaluate the first values before it can perform the second set of calculations. Calculate the value of Answer1 and Answer2 in the query. Then make ANOTHER query based on that one. In the 2nd query your IIF function should work.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 4:31:54 AM. PLT: 1s