IIF within IIF

S

Sarah Stockton

Can I put a IIF within a IIF statement? I want it to set null to zero and I
want it to calculate overtime hours.

Thanks
 
L

Lynn Trapp

The general syntax for a nested IIF statement is:

IIF(<Condition>, <If True>, IIF (<Condition>, <If True>, <If False>))
 
M

MatNorth

Better still try using this function:

nz([Number you want zero if null], 0)

The 2nd parameter in this function is the "if null" parameter ie what
would you like to put if the record is null.

NB I've found that sometimes access will switch these sorts of
expressions into string/text fields as opposed to numeric fields. The
following methodology should solve this issue:
nz([number you want zero if null], 0) + 0
 
C

Col

IIF(ISNULL([HOURS]),0,IIF([HOURS]>38,((([HOURS]-38)*([PAYRATE]*2)) +
([PAYRATE] * 38)),([HOURS]*[PAYRATE])))

Keep an eye on the ")"s... IIF(,IIF(,,),IIF(,,))
 
Top