- Scrap%: IIf([BadParts]=0,0,Nz([BadParts]/[GoodParts]))
My issue is when I select Ascending or add some sort of filter in design view, then run it I get a pop up msgbox that says "Division By Zero". I need to build reports of of this query with different filters and cannot get them to run because of this.
Please help.
Thank you so very much in advance for any help I recieve.
It's the good parts that can't be 0, not bad parts.
Edit: But also, are you trying to calculate percentage? Or ratio? If you're trying to calculate percentage, it should be bad parts divided by the sum of bad parts and good parts.
5 1261
It's the good parts that can't be 0, not bad parts.
Edit: But also, are you trying to calculate percentage? Or ratio? If you're trying to calculate percentage, it should be bad parts divided by the sum of bad parts and good parts.
Hi Kevin
I thought we had dealt with this some months ago.
As Rabbit says you must ensure that GoodParts is not Null or Zero -
Scrap%: IIf(Nz([GoodParts]) <> 0, Nz([BadParts])/[GoodParts], ???)
-
Where I have got ??? you can either substitute 0 or omit the final comma & ??? to show a blank
Phil
Thanks Rabbit and Phil, that seemed to fix it(So far).
Phil,
We did, but once I started to build a report off of the query I was getting this error. Never thought having it backwards like that would make a difference, as it was working on the form...
Again thanks for the gentle smack upside the head.
It is also often helpful to make sure your numbers are never Null, if you intend to do any calculations on them. If you are performing a Count() on either your GoodParts or BadParts, those values should never be Null, as a Count() will always return 0 if there are no records matching your criteria. This can be helpful. Then you only have to worry about catching the Divide By Zero in your final calculations.
Just something to think about as you move forward.
NeoPa 32,556
Expert Mod 16PB
I can certainly say I've fallen over that one in the past.
Well caught Rabbit & Phil. I've selected Rabbit's as BA as it was on the money and the first reply.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Dragan |
last post by:
How can I save the height of query dataheet ? When I vertically resize query
datasheet and save this size (height), it remains the same (default size)
when I open it again. . In odlder verison...
|
by: Derek Davlut |
last post by:
I have a make table query that I make a table from. I want the rows to
continue increasing but it overwrites the data each time. I am gathering
data from a linked source and to collect statistical...
|
by: Betrock |
last post by:
This is probably very simple, but I just can't see my way thru it.....
Short version: keyed values(numeric)in a lookup table are stored in a
main table. They are displayed as text values - the...
|
by: Bob |
last post by:
Hi Everybody
I have a table called tblListingInbox which is connected to my MS
Outlook InboxFolder
This is the underlying table for a query called:
qryListingConfirmed
In...
|
by: Mark Fannon |
last post by:
I created a database in SQL Server 2k which has a datetime field with only
time info in it. When I create a parameter query in Access '02 to execute
against that database and prompt for Start and...
|
by: dskillingstad |
last post by:
I'd appreciate any help I can get. I'm not sure what I'm doing wrong,
but....
I've searched these groups for some solutions but no luck.
I have an unbound form (frmSearch), with several unbound...
|
by: Ken |
last post by:
I have a form, that when I open it, it shows all items that are due for
inspection in the current month and that is overdue. This is shown in
continuous view and it has a column that shows overdue...
|
by: Lag |
last post by:
Having a problem updating my database from a web page, through a
submission form. Can anyone help?
----THIS IS MY CODE IN update.php----(user, pass, and database are
typed in directly, I...
|
by: freddylocks |
last post by:
Hi Everyone.
I have a question regarding a Mysql query I am trying to run.
I have 2 tables.
Table 1: I have a column called FN which I hope to link to another table. At present the column...
|
by: PHPBABY3 |
last post by:
Hi,
1. I have two SQL tables. I will call them employees and departments:
EMP: LAST_NAME, FIRST_NAME, DEPTNM
DEPT: NUM, NAME
Input: text string FIND
Output: the LAST_NAME, FIRST_NAME...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
| |