Friday, May 25, 2007 9:28 AM
Michael S. Kaplan
I'd stop as soon as possible, IIf you'd let me
I read Paul Vick's post IIF becomes If, and a true ternary operator and saw that a version of Visual Basic was finally going to have an IIF() that was going to properly short-circuit and not run both conditions.
And I thought about how they cheated on this in Access.
Well, technically not in Access, but in Jet. Or more specifically in the Jet Expression Service.
That is the component that does all the work to run code in queries, and also to handle all of the various possible expressions one could put into controls on forms and reports.
You ended up with that interesting (but subtle) difference in behavior where IIF() in a VBA function (that could be called from a query) could do something different than the identical IIF() code run from the query itself.
Since the first time I had ever known people to request IIF() to be a ternary operator was in Access 2.0/EB, I guess that this was accomplished in fewer than fifteen years....
And yes, it IS immediate if and not inline if. Wikipedia was wrong. Although I know lots of Access app developers who had the same misperception since they used it so commonly inside of properties to avoid writing separate VBA functions; this made it look like an "inline" operation so they called it that.
Never mind all the names people had for the debug window. :-)
This post brought to you by ∗ (U+2217, a.k.a. ASTERISK OPERATOR)