PDA

View Full Version : Populating Critirea From A Combo Box



mattster1010
10-09-2008, 03:20 AM
Morning All,

I have created a form that displays records depending on the employee name that is selected from 'Employee Name' combo box, I now need to add an additional combo box called 'Department' that will select a department i.e finanace and then display only the employee's that come under 'finance' in the 'Employee Name' combo box.

Any idea's would be appriecated.

Cheers,

Mattster

CreganTur
10-09-2008, 05:14 AM
How you handle this really depends on how your form is designed.

If the EmployeeName and Department comboboxes are part of a login screen that you use to open the record-displaying form then you can use the value of both comboboxes as part of the WHERE Condition of the DoCmd.OpenForm method.

If both comboboxes are on the record displaying form, then you can look into setting the form's recordsource via VBA and reference the combobox values as the WHERE part of the SQL statement. search for RecordSource Property in VBA help in Access.

nepotist
10-09-2008, 06:41 AM
@ Randy you really are a Pro-Gramar
As randy said if you have both the combo boxes in the login screen, have the combo box of departments to list a all the departments, then the employee combox should be based on a query with the where condition being the value of the department combobox , so that it would populate only the list of employees in that particular department. and the form would show the information for that particular employee.
( I am assuming that a employee works in one single department :D)