Drown down field as filter

lawrence whittemore asked on February 20, 2015 20:05

I have a custom table set up and I have a an alternate form set up for the table filter. I have a couple fields that pull id's from another table. I want to create a dropdown filter that pulls from the same table. I have this working mostly but the field always filters on one of the options. I've tried creating a null option but it returns no results when it is selected.

Is there a way to use a dropdown as a filter but have an "all option"?

this is what my query looks like

Select '' as 'ItemId', 'all' as 'Name' union Select ItemId, Name From EMHS_DirectoryFacility Order by Name ASC

I have also tried using null instead of an empty string.

Recent Answers


Virgil Carroll answered on February 22, 2015 17:57 (last edited on February 22, 2015 17:58)

Instead of passing any type of WHERE clause like a null or empty string, when you remind to the filter, just do not add a where clause at all. This will default the query back to returning all records (assuming that is what your base query does in the first place)

I usually do my IF statement as a:

If(!dropdownSample.SelectedValue == 'All Items') { //add WHERE clause }

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.