Custom Security Permissions

organictreatment

New member
Local time
Yesterday, 17:10
Joined
Nov 28, 2012
Messages
2
I was wondering if it is possible to create custom security permissions in access. For example I have created an employee database, with security. I would like to have it when a manager logs on, it will only display his employee's information and no other departments. Is this possible?? In one of the tables is a field for the department the employee works on, can it based off of a table field? Thanks in advance.
 
Last edited by a moderator:
For your situation, I'm assuming that you are talking about department managers. I'm also going to assume your manager is listed in your Employees table with their department listed. If so, your Login table may only need a Primary Key, Login ID, Password and some way of linking the Login PK to the Employee table. Perhaps you'll have one more field called Employee_ID in the Login table that corresponds to the PK in the Employee table.

So now you have a TblLogin and TblEmployees. You can now make a Login form followed by whatever form you want a person to see after logging in, whether it's a Switchboard form or a form directly showing TblEmployees. We will want to keep track of who's logged in, such as saving the Employee_ID in a global variable called gLogin. To simplify, I'll assume you want to go directly into a form showing the employees. So upon logging in, you have a form called FrmEmployees with the TblEmployees embedded, perhaps as a datasheet or a continuous form. Go to the On Load event of FrmEmployees, you could have code that goes something like this:
Code:
Dim department As String
department = DLookUp("[Department]", "[TblEmployees]", "[Employee_ID] = " & gLogin
Me.Filter = "[Department] = " & department
Me.FilterOn = True
This bit of code basically just checks the department of the logged in user and sets a filter for the form based on the department.
 

Users who are viewing this thread

Back
Top Bottom