B
BillE
I have a typical form/subform, and the subform is a datasheet with several
columns.
One of the columns is a combo box, and the rowsource is an SQL statement,
like:
select EmployeeID, EmployeeName, EmployeeDept from tblEmployees order by
EmployeeName
I would like the contents of the combo box to be filtered, based on the
value of another field in the datasheet. For example, showing only the
Employees in the current department.
I tried adding
where EmployeeDept = " & me.EmployeeDeptID
to the SQL statement which populates the dropdown, where EmployeeDeptID is
another field in the datasheet.
However, sometimes the "me.EmployeeDeptID" doesn't correctly refer to the
value of the EmployeeDeptID field in the current row, but has a value from
another row, perhaps the previously selected row, I don't know. The
combobox gets populated with employees from a different department.
Is there a way to do this that works?
Thanks
Bill
columns.
One of the columns is a combo box, and the rowsource is an SQL statement,
like:
select EmployeeID, EmployeeName, EmployeeDept from tblEmployees order by
EmployeeName
I would like the contents of the combo box to be filtered, based on the
value of another field in the datasheet. For example, showing only the
Employees in the current department.
I tried adding
where EmployeeDept = " & me.EmployeeDeptID
to the SQL statement which populates the dropdown, where EmployeeDeptID is
another field in the datasheet.
However, sometimes the "me.EmployeeDeptID" doesn't correctly refer to the
value of the EmployeeDeptID field in the current row, but has a value from
another row, perhaps the previously selected row, I don't know. The
combobox gets populated with employees from a different department.
Is there a way to do this that works?
Thanks
Bill