
Originally Posted by
MatthewGrace
Values like this work: "Shipped" ... "Yes" ... "True" ... 100
Values like this don't work: <>"Shipped" ... >100 ... <=20
So you see, no operators allowed with IIf().
Ajax was right in his answer, and I'm grateful for it, but I'd still like to know if there is a way to get IIf to accept operators in the truepart/falsepart area.
Thanks for the input guys.
Sorry, the outcome of an IIF statement cannot include an operator because once you insert an operator into the IIF, it is actually outputting a String or Variant. The fields are then being tested for an equal comparison to the entirety of the IIF statement's output. Ajax's approach really is best.
Offtopic---
There are some fun things you can do with IIFs and Strings in LIKE comparisons. I use these frequently for filters because I like "Any" to be an option in my filter lists.
Given a string column [strFruit], you can do this kind of thing:
Code:
[strFruit] like iif([Forms]![frmSample]![lstFilter]="Any","*",[Forms]![frmSample]![lstFilter])
Cheers,
Jeff