Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIf statement

Status
Not open for further replies.

Imbriani

Programmer
Jan 9, 2004
195
US
Can anyone point me toward some examples of an if statement where 2 conditions must be met?

I'm tryin to do something like this:

IIf ([elisaresult] = "Positive" and [subelisaresults] = "Positive", "Positive")

which of course doesn't work, but that's as close as I can get with Access help. I havne't been able to find an example of this online.

Kathy
 
Something like this ?
IIf ([elisaresult] = "Positive" And [subelisaresults] = "Positive", "Positive", "NOT positive")


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
That works! I wasn't sure I could use "And" in the statement. That sounded too easy.

Thanks so much! Can you point me to a thread that might have some more examples of complex use of IIf. (Seems like this is always the need; can't be simple)

Kathy
 
Imbriani -
I suggest just doing a search on IIf here on the Tek-Tips forums, or a Google search. However, having fought with the logic of many too-complex IIf statements, I recommend using it sparingly. For me it's too confusing to debug except for simple expressions (but maybe I'm just slow ;-)). I prefer to create VBA functions or subs and use the Select Case statement for more complex expressions.

Ken S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top