IIf() is a function that can be used directly in a query or control source. If
is used in VBA code only.
Unless you are thinking of the If() function from Excel in which case that does
not apply to Access at all.
the if statement return true or false and can be used in a query
though if then else can only be used in code.
table
cnt x y
try query
select cnt x,y,if(x>=y) as test form table
cnt x y
1 3 2 true
2 2 3 false
3 3 3 true
IIF translates to to if then A else B
it returns either A or B
this will return the biggest number between
select cnt x,y,iif(x>=y,x,y)) as test form table
1 3 2 3
2 2 3 3
3 3 3 3
I use both use IIF a lot and is very powerful,
You can also nest them like iff(a>b),"Good),iif(c>d),"also
good","Bad")
the IF statement I use in code alot but the IF by itself in a query is
good but not a useful and more heavy duty logic problem.
the iif is an inline if then else statement and return Value A if true
and Value B if false