Based on value from 1 combo box filter results in the next combo b


D

Don

I have a document tracker form that has a combo box that selects the
Department the document came from called "Departcbo". This combo has a record
source of DepartID. This combo box includes the Department name and DepartID
but only displays the department name in the drop down menu.

Based on the DepartID I would like to filter the next combo box
"OfficeOrigcbo" which is a list of the employees from the employees table.
This combo box includes EmployeeID, FirstName, LastName, and DepartmentID and
displays in the combo box drop down menu only FirstName, LastName and
DepartmentID. This filter should only return the employees in the same
department or matching DepartmentID's.

I have looked at the past posts but these mostly return values to the whole
form not just a combo box. How can I make this work?

Thanks,

Dennis
 
Ad

Advertisements

Ad

Advertisements

M

Marshall Barton

Don said:
I have a document tracker form that has a combo box that selects the
Department the document came from called "Departcbo". This combo has a record
source of DepartID. This combo box includes the Department name and DepartID
but only displays the department name in the drop down menu.

Based on the DepartID I would like to filter the next combo box
"OfficeOrigcbo" which is a list of the employees from the employees table.
This combo box includes EmployeeID, FirstName, LastName, and DepartmentID and
displays in the combo box drop down menu only FirstName, LastName and
DepartmentID. This filter should only return the employees in the same
department or matching DepartmentID's.

I have looked at the past posts but these mostly return values to the whole
form not just a combo box. How can I make this work?


Set the employee combo box's Row Source to a query that
looks something like:

SELECT EmployeeID, FirstName, LastName, DepartmentID
FROM Employees
WHERE DepartmentID = Forms![name of the form].Departcbo
ORDER BY LastName, FirstName

Then in both Departcbo's AfterUpdate event and the form's
Current event, use a line of code to keep then in sync:
Me.Employeecbo.Requery
 

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