From: Bob Barrows on
Dirk Goldgar wrote:
> "Bob Barrows" <reb01501(a)NOyahoo.SPAMcom> wrote in message
> news:OfWyZOs7KHA.1316(a)TK2MSFTNGP02.phx.gbl...
>>
>> Impossible. The IIF() function requires 3 arguments and you've only
>> supplied 2.
>
>
> Quite possible, actually. While the VBA IIf() function requires all 3
> arguments, the JET SQL IIf() function does not. In a query, it's the
> SQL version of the function that will be used, not the VBA function
> of the same name.

Learn something new every day, I guess. I always assumed it was using the
VBA function and never realized there was a JetSQL version.

I assume it returns Null if the test expression fails and no false result is
supplied ...
--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


From: Dirk Goldgar on
"Bob Barrows" <reb01501(a)NOyahoo.SPAMcom> wrote in message
news:OLCeUHD8KHA.5808(a)TK2MSFTNGP02.phx.gbl...
>
> Learn something new every day, I guess. I always assumed it was using the
> VBA function and never realized there was a JetSQL version.

There are just a couple of VBA functions that have native JetSQL functions
with the same name (and slightly different characteristics). I believe Nz()
is another, but I'm not 100% sure.

The Jet IIf() function is different in another way: the VBA function always
evaluates both the "return-if-True" operand and the "return-if-False"
operand, while the Jet version only evaluates the argument that is going to
be returned.

> I assume it returns Null if the test expression fails and no false result
> is supplied ...

Quite right.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)