vendredi 30 septembre 2016

Using OR Operator For Null Values in IIF Statement

I've got a MS access form with optional criteria for running a query. The user will select a checkbox and enter a value then run the query based on the selected fields and inputs. The issue I have for one field in particular is the table stores NULL Values. The criteria for the query looks like this:

 IIf([Checkbox]=-1,[Data in Form],([Field]Like "*" Or [Field]Is Null))

If I use this code as criteria for the field in the query, it only works when a value is in the form and the checkbox is selected. If I use the code as an expression, it returns the NULL values when the checkbox is not selected but returns all the records when the checkbox is selected and a value is entered. if I use Like "*" or Is Null as a criteria, it works returning all the records so why isn't it working as a part of the IIF statement?




Aucun commentaire:

Enregistrer un commentaire