Hello, I am attempting to limit the ability of supervisors to view only their employees. I have the ability to pull the list in a qry dependent on their AccessLevel. There is a many to many relationship between tblSupervisor and tblDepartment. I have created a Junction table tblSupervisor_tblDepartment. when I use the junction table, it is tripling the number of employees unless I groupby. This poses the problem of the inability to enter data on the form if I set the record source to the qry. Currently I have it set to a tbl to avoid entry problem and each Supervisor sees all the employees. If the AccessLevelID is 1, then I need the Director to see all the employees, otherwise, it is specific to the other AccessLevel. Here is my qry
SELECT tblEmployee.EmployeeID, tblDepartment.DepartmentName, tblEmployee.EmployeeName, tblDepartment.DepatmentAccessLevelID
FROM (tblDepartment RIGHT JOIN tblEmployee ON tblDepartment.DepartmentID = tblEmployee.DepartmentID) LEFT JOIN tblSupervisor_Department ON tblDepartment.DepartmentID = tblSupervisor_Department.DepartmentID
GROUP BY tblEmployee.EmployeeID, tblDepartment.DepartmentName, tblEmployee.EmployeeName, tblDepartment.DepatmentAccessLevelID
HAVING (((tblDepartment.DepatmentAccessLevelID)=[Forms]![frmNavMain]![txtUserAccessLevel])) OR ((([Forms]![frmNavMain]![txtUserAccessLevel])=1))
ORDER BY tblDepartment.DepartmentName, tblEmployee.EmployeeName;
Any help or thinking outside the box would be much appreciated. I have tried multiple ways to make this work. Even tried to have a list box (list for double click based on the groupby qry) with after update go to record with the same ID. Problem there is that the form still opens to all employees. I do not want the form edited by specific AccessLevels so I cannot set to new and then just click on the list.