Showing all data if criteria is blank

M

Mike

I have a form (frmDisplay) based upon a Query (qrySignInventoryFields). On
the form header I have an unbound combobox (Combo133) listing all Streets
available with sign data.

Currently the Query is filtered based upon the selection in the unbound
combobox.

When the form first opens and a default "Show All" is diplayed in the
unbound combobox. I want the form to display all the records when the
combobox is a default value of "Show All" is selected.

I do not know how to code this.

Any help would be appreciated.

Thanks.
 
O

Ofer

Try this

Select * From TableName Where FieldName Like
iif(Forms![FormName]![ComboName] = "Show All"
,"*",Forms![FormName]![ComboName])
 
M

Mike

Thanks for the help, but I went another route with this.

I removed the default, so that initially the combo is null, added criteria
to the query to display all if combo is null. Then added a command button
that sets the combo to null. On startup the form displays all records.
Users can filter by streets using the combobox, but then to return to all
records, users can just click the show all button.



Ofer said:
Try this

Select * From TableName Where FieldName Like
iif(Forms![FormName]![ComboName] = "Show All"
,"*",Forms![FormName]![ComboName])

Mike said:
I have a form (frmDisplay) based upon a Query (qrySignInventoryFields). On
the form header I have an unbound combobox (Combo133) listing all Streets
available with sign data.

Currently the Query is filtered based upon the selection in the unbound
combobox.

When the form first opens and a default "Show All" is diplayed in the
unbound combobox. I want the form to display all the records when the
combobox is a default value of "Show All" is selected.

I do not know how to code this.

Any help would be appreciated.

Thanks.
 
Top