combo box selective display

G

Guest

Hi,

I have a combo box that contains employee ID#s. The combo box is based on
an "EmployeeID" table that contains the following fields:

[EmployeeID], [EmployeeName], [Active]

[Active] is a yes/no checkbox. When an employee is not active, he/she no
longer is working with us. So, I would like the combo box to only display
the employees that are currently active. Yet, at the same time, I would like
the ability to enter an old inactive employee's ID# for odd cases.

Does anyone know how to get the combo box to selectively display employees?

Thank you!
Diana
 
G

Guest

Hi Diana,

it takes a little coding but it easy. The trick is to modify the combo
box's record source to use SQL code (one method is to use the query creator
to do it) which has the "WHERE" clause set to something like "WHERE Active".
(This assumes [Active] is a boolean field, which you say it. Thus, if
[Active] is checked (true), the value is displayed.

Taking a stab at the complete SQL line, using your fields, it'll look
something like "SELECT EmployeeID, EmployeeName FROM tblEmployeeID WHERE
Active;". Then, obviously, you set the combo box's various format/data
settings to display the 2nd coloumn (EmployeeName) while keeping the 1st
column value (EmployeeID).

Hope this helps. Good luck!
A
 

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

Similar Threads


Top