Quantcast
Channel: Access for Developers forum
Viewing all articles
Browse latest Browse all 14673

Conditional Criteria in Access Query

$
0
0

I'm trying to build an expression for the criteria of a field in my query.

The criteria is If the value of a combobox on a form is not equal to "Show All" then to use the value of the combobox, otherwise allow all records (ie no criteria constraint).

I understand the syntax for the If statement and how to reference the form. The problem is that when the value of the box IS "Show All" i do not know how to allow all records to be returned.

I have tried a wildcard as below in the falsepart of the IIF statement, but I know this wont work because it's trying to match the literal string.

   IIf([Forms]![myTestForm]![comboBox1]<>"Show All",[Forms]![myTestForm]![comboBox1],"*")

How do I have to structure the falsepart of the IIf statement to allow all values?


Viewing all articles
Browse latest Browse all 14673

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>