I need help with Immediate If Function

Talismanic

Registered User.
Local time
Today, 09:08
Joined
May 25, 2000
Messages
377
I have an Immediate If that looks like this:

GetValue: IIf([extrate]>[pwrate], [extrate],[pwrate])

Is there a way to throw another condition in this query? I would like to evaluate another field that will have either a 1, 2 or 3 in it. So I would need to incorporate a AND/OR into this GetValue. Is this possible?

If that doesn't make sense, let me try it this way:


If OtherField has 1 or 2 do GetValue if it has a three, ignore the GetValue ImediateIF Function and place a null or at the very least a 0 in the GetValue field.
 
GetValue: IIf(OtherField = 1 or OtherField = 2),IIf([extrate]>[pwrate], [extrate],[pwrate]),0)

The basic format for the IIf() is
IIf(condition, true path, false path)

The condition may be compound and the IIf() may be nested for either or both the true and false paths.

IIf()'s can get difficult to read when they have more than a few conditions. You can always create a function where you can use a Case statement, which is much easier to read and understand.
 
I am missing soemthing because I am getting an error that says the Expression you entered has a function with the wrong number of arguments.

GetValue: IIf([EarnCode]=1 or [EarnCode]=2), IIf([extrate]>[pwrate], [extrate],[pwrate]),0)

Do you see anything wrong with the way I am doing it?
 
My guess is another set of parentheses (spelling???). Try this:

GetValue: IIf(([EarnCode]=1 or [EarnCode]=2), IIf([extrate]>[pwrate], [extrate],[pwrate]),0)
 
I don't post much... and here is why. I thought I'd share for anyone new coming out here. I use the search feature before I do anything else - and was racking my brain with a nested iif function, trying to figure out how I could possibly be messing it up. This "old" post lit a lamp in my brain and I have the problem solved.

Thanks - belatedly - for all of the help this forum provides.
 
cfmiles, I am he, formaly know as Talismanic and I gotta agree with you there. I just love the search feature and can usually find about 90% of everything I am looking for with it.
 

Users who are viewing this thread

Back
Top Bottom