This forum is about taking the next step (or perhaps the next two steps) toward becoming a better Access programmer, and the AWF Forum Members will help you on your journey.To I can't remember the finer details of exactly where I've found this (may even be in Excel rather than Access) but there certainly is somewhere where Nz() is not available but So example on of my fields is called SumOfGeneral_Repair. IIf([text39]>0, (Sum([SumOfGeneral_Repair])/[text39]) ,0) __________________ No one is expected to know everything and we can all learn from each other if we try. get redirected here
I suggest . . . .O&M FY10: IIf(Nz([Est life in years],0)=0,0,(((([failure rate per year]*[AC TOT FP FY10]*[AVG Repair Cost per Repair])*(1-1/[Est life in years])*([Annual inflation])+(AC TOT FP FY10]*[Item cost per fy10])/[Est Since I believe that when you use IIF as an expression in a control (as opposed to using it in a query) both the True and the False argument are evaluated. Divide By Zero Divide by zero. Please help, I am new to MSaccess and this is causing me some grief. https://www.techonthenet.com/access/queries/divide_by_zero.php
Jan 5 '08 #8 reply Expert 2.5K+ P: 3,532 missinglinq Well, of course, you'ved piqued my curiosity now! So the expression in a calculated field in query could be as follows: IIf(Nz([proc1],0)=0,0,Nz([rtn 1],0)/[Proc1]) John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County Duane Hookom So my reasoning was wrong when I worked it out in my head. Username Changing provided by Username Change v1.3.0 (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Your name or email address: Do you already have an account? Thanks in advance, Mark "fredg" wrote: > On Wed, 13 May 2009 12:09:04 -0700, Mark H wrote: > > > I am trying to divide two columns and get a percentage Kryst51 View Public Profile Find More Posts by Kryst51
rkrause View Public Profile Find More Posts by rkrause 07-20-2009, 12:09 PM #2 pbaldy Wino Moderator Join Date: Aug 2003 Location: Nevada, USA Posts: 28,871 Divide By 0 Error In Sql You may have to break out [AHT] in its own query. Mark H, May 13, 2009 #1 Advertisements fredg Guest On Wed, 13 May 2009 12:09:04 -0700, Mark H wrote: > I am trying to divide two columns and get a percentage http://answers.microsoft.com/en-us/msoffice/forum/msoffice_access-mso_windows8/getting-an-error-in-access-query-division-by-zero/6aca4dd8-3dda-45e6-8559-c6489dc8f8c1 Divide by Zero on Report (#Num!) P: 74 ollyb303 Hi, I have created a report in my Access db which has two columns - I'll call them Number1 and Number2.
Advertisements Latest Threads WCG Stats Sunday 09 October 2016 WCG Stats posted Oct 9, 2016 at 8:00 AM HAPPY BIRTHDAY DARCY bootneck02 posted Oct 9, 2016 at 12:41 AM WCG Stats Can't Divide By 0 Browse more Microsoft Access / VBA Questions on Bytes Question stats viewed: 4503 replies: 9 date asked: Jan 4 '08 Follow this discussion BYTES.COM © 2016 Formerly "TheScripts.com" from 2005-2008 About Do you want to ignore it from the calculation of the average? A blank is displayed in the report control.
I get 2 as my results but for February if Field A is zero and Field B is zero, i get and #error message therefore I can't calculate an average for https://bytes.com/topic/access/answers/603426-divide-0-null I also have a textbox that is counting the rows that do not have a zero. Divide By Zero Error Access Query Quote: Originally Posted by Kryst51 Iif([text39]>0,Sum([SumOfGeneral_Repair])/[text39] ,Sum([SumOfGeneral_Repair]) Disclaimer: I am not sure if this is correct. Divide By 0 Error Java I will always be dealing with zero as an answer, that is just unavoidable.
Mine took care of the problem if Number2 was Null, and yours took care of the problem if Number2 = 0, but neither took care of both possibilities! Get More Info Quote: Originally Posted by Kryst51 LOL, I have never been good at math..... I would replace the "" with Null. > > > > =IIf(Nz([Ext Price Compare 1],0)=0 or Nz([Ext Price Compare > > 2]),0)=0,Null,([Ext Price Compare 1]/[Ext Price Compare 2])-1) > > > Similar topics Divide two number Generate a random number then use that to divide the user input number An implementation where sizeof(short int) does not divide sizeof(int) Division by 7 without Divide By 0 Error Excel
Any help gratefully received. This is achieved with the following formula: IIf([Quantity]=0,0,[Price]/[Quantity]) Now, your Access query should no longer return an error when a [Quantity] of 0 is encountered. How do I configure the display of members' images and signatures? useful reference You currently have 0 posts.
You'll be able to ask any tech support questions, or chat with the community and help others. Divide By 0 Exception Java gemmathehuskyView Member Profile Mar 20 2011, 01:53 PM Post#12UtterAccess VIPPosts: 4,061Joined: 5-June 07From: UKthat's ok, as long as you are happy to see 0, where the estimated life is null, or So I modified yours! =IIf([Number2]= 0 or IsNull([Number2]),[Number1],[Number1]/[Number2]) Linq ;0)> Jan 5 '08 #7 reply Expert Mod 15k+ P: 29,922 NeoPa Actually, Ade, if you think about it, if one Access
So you might have to use > something along the lines of the following to keep the division from > generating an error. > > =IIf(Nz([Ext Price Compare 1],0)=0 > or MSAccessRookie View Public Profile Find More Posts by MSAccessRookie 07-20-2009, 01:12 PM #9 Kryst51 Singin' in the Hou. Your instructions worked. Divide By 0 Infinity boblarson View Public Profile Visit boblarson's homepage!
Since you are attempting to use the Immediate If function, I will presume it is in a query. How should I configure my browser to get the greatest benefits from the Lounge? with the nz function it will return a 0 in the code I have included. this page What can I do to bypass this?
PC Review Home Newsgroups > Microsoft Access > Microsoft Access Reports > Home Home Quick Links Search Forums Recent Posts Forums Forums Quick Links Search Forums Recent Posts Articles Articles Quick Sign Up Now! So what i have in my report footer for formula is: =Sum([SumOfGeneral_Repair])/[text39] How would i incorparate that formula so i can forget the divide by zero error? I do not reply to personal e-mail fredg, May 13, 2009 #7 Duane Hookom Guest I don't care for IIf() or any other expressions that could return two different data
No, create an account now. norieView Member Profile Mar 14 2011, 08:29 AM Post#2UtterAccess VIPPosts: 4,448Joined: 29-April 06Is that expression actually returning the division by zero error? My thinking and reasoning skills are a little off today, due to the fact that I am tired..... MSAccessRookie View Public Profile Find More Posts by MSAccessRookie 07-20-2009, 01:01 PM #5 Kryst51 Singin' in the Hou.