问题
I'm trying to get my query to only return null records if a radio box on a form is ticked. If I manually include the criteria Is Null in the query it works just fine, and elsewhere things like
IIf([Forms]![Reports]![Status - Active]=True,"Active")
work just fine.
However,
IIf([Forms]![Reports]![Status - Null]=True,"Is Null")
just ignores it (I assume because it's actually looking for the text "Is Null" rather than null records) and
IIf([Forms]![Reports]![Status - Null]=True,Is Null)
fails because it's too complex. Is there any way of achieving what I'm trying to achieve?
Thanks.
回答1:
You could work around in a couple of ways, for example.
SELECT t.atext
FROM Table1 t
WHERE IsNull([atext])=[Forms]![Reports]![Status - Null]
BTW, Immediate If (IIf) takes three arguments.
来源:https://stackoverflow.com/questions/13413987/using-is-null-as-a-criteria-based-on-a-form