Returning sorted list to combo box

Returning sorted list to combo box

am 11.11.2007 05:49:53 von tbrogdon

I have a form (myForm) which has the following combo boxes:
1) Shift (selects shift 1, 2, or 3 from tblShift) this value is not
stored in a field.
2) Department (selects Dept1, Dept2, or Dept3 from tblDept) this value
is also not stored.

3) Then I have a combo box for Employees' names. This list is
generated from tblEmployees w/ fields FirstName, LastName, Shift, and
Department.

On myForm, is it possible to select the Shift number, the Department
name and have Access only return the names of the corresponding
employees to my Employees name combo box so that the user only chooses
employee names for the chosen shift and department instead of the
whole plant?

Thanks in advance,

Tim

Re: Returning sorted list to combo box

am 11.11.2007 08:12:40 von tina

yes. change the RowSource for the third combo box to

SELECT FirstName, LastName FROM tblEmployees WHERE Shift =
Forms!myForm!cboShift And Department = Forms!myForm!cboDepartment

the above statement goes all on one line in the combobox's RowSource,
regardless of line wrap here. add the following code to the AfterUpdate
event procedures of the Shift and Department combo box controls, as

Me!cboEmployee.Requery

change the names of the combo box controls in the RowSource and the code
above, to the "real" names in your form, and ditto the form name.

hth


wrote in message
news:1194756593.561474.217790@o3g2000hsb.googlegroups.com...
> I have a form (myForm) which has the following combo boxes:
> 1) Shift (selects shift 1, 2, or 3 from tblShift) this value is not
> stored in a field.
> 2) Department (selects Dept1, Dept2, or Dept3 from tblDept) this value
> is also not stored.
>
> 3) Then I have a combo box for Employees' names. This list is
> generated from tblEmployees w/ fields FirstName, LastName, Shift, and
> Department.
>
> On myForm, is it possible to select the Shift number, the Department
> name and have Access only return the names of the corresponding
> employees to my Employees name combo box so that the user only chooses
> employee names for the chosen shift and department instead of the
> whole plant?
>
> Thanks in advance,
>
> Tim
>

Re: Returning sorted list to combo box

am 12.11.2007 16:54:58 von tbrogdon

Thanks Tina! That worked.

Tim

Re: Returning sorted list to combo box

am 13.11.2007 05:54:13 von tina

you're welcome :)


wrote in message
news:1194882898.262097.297100@19g2000hsx.googlegroups.com...
> Thanks Tina! That worked.
>
> Tim
>