473,387 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

iif Statement not working when there is a zero vlaue

418 256MB
Hi,
My report (rBalance) is based on a query (q3). q3 is based on two other queries (q1) & (q2)

q1 has two figures: Budget amount and Draw amount
q2 has one figure: Authorized amount. This is a calculated field. Budget amount X Ratio %

To get to balance amount. i am using Authorized Amount - Draw Amount.

Everything works except when there is not Draw Amount.

I tried, "iif(([AuthorizedAmount]-[DrawAmount]) <> 0, [AuthorizedAmount], ([AuthorizedAmount-[DrawAmount]))

I know this should be simple but I just couldn't get it to work. Please help. Thanks.
Jul 15 '14 #1

✓ answered by twinnyfo

Is draw amount actually 0 (zero) or is it Null. There is a huge difference between the two....

If DrawAmount is Null (even if it is not), you can use the following:

Expand|Select|Wrap|Line Numbers
  1. [AuthorizedAmount] - Nz([DrawAmount], 0)
Hope this helps.

4 996
twinnyfo
3,653 Expert Mod 2GB
Is draw amount actually 0 (zero) or is it Null. There is a huge difference between the two....

If DrawAmount is Null (even if it is not), you can use the following:

Expand|Select|Wrap|Line Numbers
  1. [AuthorizedAmount] - Nz([DrawAmount], 0)
Hope this helps.
Jul 15 '14 #2
MNNovice
418 256MB
Thanks. But it didn't work either. Here is the actual expression I used.

Balance: IIf([FTAAmount]-Nz([SumOfiAmountECHO],0),[FTAAmount],([FTAAmount]-[SumOfiAmountECHO]))

The balance comes out okay where there is no value for SumOfiAmountECHO. But if I have a value for this field the balance is incorrectly showing up as FTAAmount instead of FTAAmount - SumOfiAmountECHO.

Thanks for your time.
Jul 15 '14 #3
twinnyfo
3,653 Expert Mod 2GB
There should be no need for the IIf statement. The Nz() function precludes a need for it.
Jul 15 '14 #4
MNNovice
418 256MB
Got it. Thank you. Much appreciated.
Jul 15 '14 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Mike | last post by:
Hi all, I have a vb.net program running as a service that uses a network path to query a file. If System.IO.File.Exists(fpath & "\" & filename) Can anyone tell me why the above isn't working?...
3
by: jan82 | last post by:
Hi all I'm developing a website with Visual web developer in C#. Everything works fine when testing using ctrl+F5. Also, IIS runs ASP.NET pages without any problems. The problem I'm facing...
1
by: shumaila | last post by:
hello all can anybody help me???? My asp pages are not working, when i run it, it ask me for downloading?
0
by: Rotsey | last post by:
Hi, I have a web site dev with VS2003, .NET 1.1. I am persisting the login with the statement below When I login and then close the browser repoen it works fine. But when I leave the session...
0
by: jk9427 | last post by:
Hello all, I have a weird situation here. We are on an ISeries AS400. We have created an SQL table and can access it just fine when the COBOL program is called directly. The problem exists when...
4
by: Badboy112 | last post by:
Hi guys im not sure what i am doinf wrong but the if statement in the action performed is not working any ideas import java.io.*; import javax.swing.*; import java.awt.*; import...
1
by: kelly sinclair | last post by:
#include<stdio.h> int main() { char *name; float bal,stbal,deposits,withdrawals; int nw,nd,i; printf("Welcome to the Sinclair Banking System."); /* Introduction to program*/;...
2
by: Terri Dorr | last post by:
Hi! i have a sales report that i run monthly, which has the current month, ytd sales, and prior year sales. What i am trying to do is when there is a month that a particular account had zero sales...
2
by: spathiphyllum | last post by:
Access2013 stops working when I open any table in design mode, and select any field having the type "Number". I can edit Text, Date or Yes/No fields, but not Number ones. I tried to compact and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.