Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

#Div/0! in query field

Posted on 2014-12-22
3
Medium Priority
?
114 Views
Last Modified: 2014-12-22
I'm getting #Div/0! in a query field result using:

SchedLBHR: [tblLoadingSchedule.TotalWeight]/[ConvertedSchedHrs]

I tried:

SchedLBHR: [tblLoadingSchedule.TotalWeight]/Nz([ConvertedSchedHrs],0)

But that didn't work.
0
Comment
Question by:SteveL13
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 40513016
SchedLBHR:IIF(Nz([ConvertedSchedHrs],0)=0,0, [tblLoadingSchedule.TotalWeight]/[ConvertedSchedHrs])
0
 
LVL 40

Expert Comment

by:PatHartman
ID: 40513036
The point is that you cannot divide by zero so using Nz(), although it will change null to zero isn't a complete solution.  Rey's example shows how to return a 0 when the divisor is zero
0
 

Author Closing Comment

by:SteveL13
ID: 40513037
That did it.  Thanks.
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

916 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