How to Exclude Selected Employee from Supervisor Combo Box in Access
Question details
The user needs to configure a Microsoft Access form so that the supervisor combo box dynamically excludes the employee currently selected or being edited.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Editing employee records in an Access form where a user must select a supervisor, preventing an employee from being assigned as their own supervisor.
- Observed behavior
- The supervisor combo box needs to dynamically filter its dropdown list to hide the current employee record being edited.
Ensure you have design view access to your Microsoft Access database form and a basic understanding of SQL RowSource properties and VBA event procedures.
Modify RowSource SQL and Requery via VBA
Dynamically filter the supervisor combo box using SQL to exclude the current Employee ID and use VBA to requery the list when the record changes.
This method ensures that the combo box relies on the form's active record to filter out the current employee. By using the Nz() function, it also prevents errors when creating a new record where the EmployeeID might temporarily be null.
Open your Access form in Design View, select the Supervisor combo box, and open the Property Sheet. Navigate to the Data tab and edit the RowSource property to include a WHERE clause: WHERE EmployeeID <> Nz(Forms!frmEmployees!EmployeeID,0).
Switch to the Event tab for the form itself. Click the ellipsis (...) next to 'On Current' to open the VBA editor, and add the code: Me.cboLineManager.Requery.
Similarly, find the 'After Update' event for the form, open the VBA editor, and add the exact same requery code: Me.cboLineManager.Requery.
Save your form and switch to Form View. Verify that the current employee's name no longer appears in the supervisor dropdown list.

Filter by an IsSupervisor Yes/No Field
Add a boolean field to your Employees table to easily filter the combo box to only show designated supervisors.
Looking for a Free, Lightweight Office Suite?
While WPS Office does not include a database management tool like MS Access, it is the perfect free alternative for your daily document, spreadsheet, and presentation needs. It is highly compatible with Microsoft formats and features a familiar, easy-to-use interface.

Frequently Asked Questions
Why isn't my Access combo box updating when I move to a new record?
The combo box list is static until it is explicitly requeried. You need to add a Me.YourComboBoxName.Requery command in the On Current event of the form to force it to refresh the data when navigating between records.
What does the Nz() function do in the SQL RowSource?
The Nz() function evaluates an expression and returns a specified value (like 0) if the expression is Null. This prevents errors in your SQL query when you are on a new blank record that does not yet have an EmployeeID.
Can I change the combo box RowSource entirely using VBA?
Yes. In the After Update event of the employee combo box, you can declare a string variable with your complete SQL SELECT statement and assign it to the RowSource property (e.g., Me.cboSupID.RowSource = strSQL).




