
Originally Posted by
bcmarshall
A lot of programmers don't like nested IIf Statements, but I've used them successfully for years. I say if it works, go for it.
The problem with your nested IIf is an extra ")", which gives you invalid syntax.
IIf([Expected due date]<Date(),[Expected due date],) IIf([Expected due date] is null,[Customer due date])
Rewrite it as follows.
IIf([Expected due date]<Date(),[Expected due date],IIf(IsNull([Expected due date]),[Customer due date],Null))
The second, nested IIf didn't have a falsepart so I just added Null to it. You can change that if you wish. The final close paren is at the end of the statement, not in the middle.
One other thing. You should not use spaces in your field names. [Customer Due Date] should be [CustomerDueDate]. This is programming, not Grammar101.
A way of avoiding nested IIf statements is to use the Switch function. My own view is that as long as the computer understands what you're asking of it, you're golden.