A poster on another forum wanted to query a numeric field using the input from a parameter prompt OR > 0 if there was no input. I tried every iteration of an IIF expression falsepart that I could think of only to find that it would not properly evaluate > 0 or = 0 for example.
A sample would be IIf([Enter Value] Is Null,>2,[Enter Value]) . Result is 0.
I tried
- Eval on various forms of > (quotes, no quotes, etc); result was sometimes an error
- the wildcard * (thought these could not be used on numbers) e.g. Like IIf([Enter Value] Is Null,"*",[Enter Value]) - that's just one.
- tried Nz;
IIf(Nz([Enter Value],0)=0,(>1),[Enter Value])
IIF(Nz([Enter Value],0),>1,[Enter Value])
IIF(Nz([Enter Value],0) = 0,>1,[Enter Value])
Nothing worked. With no input, I either got no records, 0 (see blue above), or an error. So this is a two part post I guess.
Part 1 - does anyone know if operators can be used in truepart or falsepart of IIF? I searched long and hard but found nothing.
Part 2 - the eventual solution (regrettably not mine) to the problem. It's so simple that I will now fold up my laptop and go get some beer, because I'm a dummy.
I will leave that for a bit to see if anyone wants to take a whack at it - and no cheating!
BTW, regarding the Nz function in query criteria, I found this interesting:
http://allenbrowne.com/QueryPerfIssue.html - specifically the IIf(), not Nz() paragraphs.