Nested IIF in Query

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
 
M

Michel Walsh

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top