Adding criteria "ALL" to Combo or List Box

wwce

New Member
Joined
Feb 4, 2013
Messages
19
I have a form titled "Branch".

It contains a Combo Box titled "Manager" with a list of 5 names.

And a List Box titled "Employees" with about 30 names.

When the user selects a manager from it's drop down list, the employee list box gets populates with all the people under that manager only.

SCENARIO:

I want to add a field to select "ALL" employees, so that when the user selects "ALL" on the manager Combo Box, everyone (all 30 employees) will be populated in the employee List Box.

Is that possible?

Any help is appreciated, thanks.
 
Last edited:

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
for the RUN button ON CLICK event

Code:
if cboEmp = "All" then
   docmd.openquery "qsEmpsAll"
else
   docmd.openquery "qs1Emp"
endif
 
Upvote 0
for the RUN button ON CLICK event

Code:
if cboEmp = "All" then
   docmd.openquery "qsEmpsAll"
else
   docmd.openquery "qs1Emp"
endif


Hi thanks, but that's not quite it.

I was actually thinking it may be how the "Row Source" for the "Employees" List Box is coded.

So far I have it like this in SQL:

SELECT tblEmp.Employee
FROM tblEmp INNER JOIN tblMgr ON (tblEmp.Manager = tblMgr.Manager)
WHERE (((tblMgr.Manager)=IIf([Forms]![Form Branch]![Employee]="ALL","*",[Forms]![Form Branch]![Employee])));
 
Upvote 0
You can use a UNION query to add 'ALL'.

How are you currently populating the combobox?
 
Upvote 0
You can use a UNION query to add 'ALL'.

How are you currently populating the combobox?

Thanks, I'm not quite sure how the syntax for the UNION query should be, I just added it on the syntax to get the string "ALL".

My combo box "Manager" is basically a simple table and I'm using the Row Source command to call the list.

SELECT tblMgr.Manager
FROM tblMgr
UNION SELECT "ALL"
FROM tblMgr;

???
 
Upvote 0
That looks about right, is it not working?
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,748
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top