Results 1 to 6 of 6
  1. #1
    mlrucci is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    202

    Using Navigation form, click on list box to open specific record

    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.

  2. #2
    mlrucci is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    202
    I forgot to mention that my frmAdminEmployee is a "subfrm" in my navigation form "frmNavMain".

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    In what table do you want to edit/create records - tblEmployee?

    Supervisor and employee are linked through department?

    Perhaps need a form/subform/subsubform arrangement.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    mlrucci is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    202
    For this particular form frmAdminEmployee, I would like to edit through the Employee table. The purpose is to have one main form "frmNavMain" contain all the information they are going to need set in the tabs. This could include other forms based on other tables. I want only access to their employees to be accessible based on their access level. Each supervisor should not see the other's employees. Currently each employee has one department. Each department can have multiple supervisors and each supervisor can have multiple departments. (as to why I set up the many to many junction table). I have thought about building a subform that had all the employees the supervisor can edit, but it will eventually have to base that for multiple subforms and I have been unable to figure out how to filter all subforms with the same list. So very frustrated and lost. I am fairly new to vba and am self taught. Any help would be appreciated. I am including a stripped down version if you wouldn't mind taking a peak.
    Attached Files Attached Files

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Are you going to distribute db as a multi-user split design? Are you going to distribute with settings to prevent direct viewing of objects in Navigation Pane?

    Really shouldn't have a separate table for supervisors. Supervisors are employees and supervisors have supervisors. Pull supervisors from tblEmployee and save that ID into tblSupervisors_tblDepartments, however, not seeing this junction table. The EmployeeID can also be the value saved into Supervisor field of tblEmployee. This is a recursive relationship, table is joined to itself in queries to show the employee/supervisor relationship.

    Not really understanding how a person can supervise multiple departments and shouldn't a department have only one supervisor? I mean Accounting Dept has only one Manager, right? There might be subdivisions within a department that each have a supervisor but each organizational entity has only one head on the org chart.

    I've never used Navigation Form in any db I built, don't like it. Will have to look at some more tomorrow.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    mlrucci is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    202
    June7, your information helped! because I had so many tables and joins, I made it confusing. I changed over and I put the IDs into the Employee table and now it seems to work with new qry. Thank you very much for your help!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. double click on a list to open record
    By mlrucci in forum Forms
    Replies: 3
    Last Post: 07-29-2018, 07:41 PM
  2. Replies: 6
    Last Post: 02-28-2017, 09:33 AM
  3. Replies: 8
    Last Post: 02-04-2016, 05:10 PM
  4. Replies: 2
    Last Post: 03-13-2013, 06:13 PM
  5. Replies: 10
    Last Post: 02-20-2012, 11:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums