Dropdown box with Selection of All by default

G

Galco

Would like to have a form with dropdown lists where people can choose their
query selection criteria where if no specific value chosen then looks for all
values or preferably add to the dropdown query list a value of "All"
Have tried:
IIf([forms]![Areas]![Area]="All",Like "*",[forms]![Areas]![Area]")
IIf([forms]![Areas]![Person]="All",Like "*",[forms]![Areas]![Person]")
 
F

fredg

Would like to have a form with dropdown lists where people can choose their
query selection criteria where if no specific value chosen then looks for all
values or preferably add to the dropdown query list a value of "All"
Have tried:
IIf([forms]![Areas]![Area]="All",Like "*",[forms]![Areas]![Area]")
IIf([forms]![Areas]![Person]="All",Like "*",[forms]![Areas]![Person]")

What is the rowsource of the combo box?
A Table or Query?

Note that the symbols <> surround the word "All". That is to have the
list sort with the word <All> at the top of the list before any other
"A" listing.

First add "All" to the drop down list.

As rowsource of the combo box, adapt the following:

Select tblName.Area From tblName Union Select
"<ALL>" from tblName Order by Area;

The above will result in a combo list similar to the following...
<All>
AreaA
AreaB
AreaC
etc...

Then to filter data in the query, change the query criteria to:

Like
IIf([forms]![FormName]![ComboName]="<ALL>","*",[forms]![FormName]![ComboName)

Change the table and field names to your actual table and field names.
The form must be open when the query is run.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top