Iif Isnull Or Iif

Tony1258

Registered User.
Local time
Today, 12:26
Joined
Jun 8, 2006
Messages
29
I am trying to create a multiple IIF statement with IIF(ISNULL([xxx]) and an or and it does not work any help would be appreciated.

See below

IIf(IsNull([AI Rate]) or IIf([AI Rate]>0),0,1)
 
use nz to handle nulls - its much easier

do

iif(nz([ai rate],0),response for zero, response for non-zero)

despite what some posters here say, nz will automatically deal with a null, and replace it with a value of your choosing.

ie nz([ai rate],0) sets [a1 rate] to zero if it is null, and doesn't change it otherwise

if [myvar] is a string then the syntax
nz([myvar],"") converts it to a zero length string
 
Tony
using NZ as stated by Gemma is perfectly good
if had wanted to stick with your original approach then the syntax is
IIf(IsNull([AI Rate]) or ([AI Rate]>0),0,1)

Gemma the statement

despite what some posters here say, nz will automatically deal with a null, and replace it with a value of your choosing.
worries me, it suggests that you did not follow the discussion on the thread where this was aired, did you look at the examples where Nz causes difficulties?

Brian
 

Users who are viewing this thread

Back
Top Bottom