Link to home
Start Free TrialLog in
Avatar of pdvsa
pdvsaFlag for United States of America

asked on

Switch error

Experts, I have a wrong number of arguments in this SWitch statement:

PastDueOrPendingSWITCH: Switch([Due Date Per Docs]<Date() & Isnull([Completed]),"Past Due", IsNull([Completed] and [Due Date Per Docs]<Date(),"Pending", IsNotNull([Completed]),"Completed",1=1,"Other")

Not sure if "IsNotNull" is the issue.  I also tried Nz([Completed]),"")="".  I imagine it is a comma or a parenth but I dont see it.

thank you
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

I like to break these up into pairs on separate rows, then delete the carriage returns.  It looks like you have the correct # of argumens, but need to use the AND in the first comparison, not the &

PastDueOrPendingSWITCH: Switch(
[Due Date Per Docs]<Date() AND Isnull([Completed]),"Past Due",
IsNull([Completed] AND [Due Date Per Docs]<Date(),"Pending", IsNotNull([Completed]),"Completed",
1=1,"Other")
ASKER CERTIFIED SOLUTION
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pdvsa

ASKER

Thank you Gustav.   Thanks for pointing out that the first 2 tests were identical.  

Fyed:  seems there was a wrong number of arguments
You are welcome!

/gustav
I was missing a ), but also didn't pick up on the fact that the first two were identical until after Gustav mentioned that.