Nested IIF in Query

  • Thread starter Thread starter DS
  • Start date Start date
D

DS

I'm having a problem with this nested iif statemnet. I'm getting wrong
number of argument errors.
The statement is part of a Query

DOC:iif(PayNameTypeID=2,PayAppliedCCRef,
iif(PayNameTypeID=4,PayAppliedDocID, iif(PayNameAppliedID = 5,
PayAppliedDocID, iif(PayAppliedNameID = 10,PayAppliedCreditID),"",)))))))

Thanks
DS
 
Ech iif should have 3 arguments. Your most embedded one has only 2, among
other problems:

iif(PayAppliedNameID = 10,PayAppliedCreditID)


On the other hand, it is much easier to use a SWITCH statement:


DOC: switch( PayNameTypeID=2, PayAppliedCCRef,
PayNameTypeID=4, PayAppliedDocID,
PayNameAppliedID = 5, PayAppliedDocID,
PayAppliedNameID = 10, PayAppliedCreditID )


Vanderghast, Access MVP
 
Back
Top