View Full Version : A substitue for IIF(expr,Tue,False)?

09-06-2004, 03:04 PM
I would like to avoid using

If expr Then
Something Else
End If

I was sure there was something but I can't find a reference for it and nothing I tried is working.

Thanks for your help.

09-06-2004, 07:34 PM
"Select Case" maybe? (Not sure if you know about this one or this is what you're wanting.)


09-07-2004, 06:48 AM
You can use a normal If...Then...Else statement in a single line without EndIf.

Visual Basic:
CheckIt = IIf(TestMe > 1000, "Large", "Small")

If TestMe > 1000 Then CheckIt = "Large" Else CheckIt = "Small"

09-07-2004, 12:57 PM
Thanks Glenn,
I didn't know I could use an Else in the same line. I should have. Maybe just an old habit of putting it in a block. I ended up doing it the way I didn't want to just so I could move on. I can go back and change those lines now. The reason? It just looks cleaner.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum