Best way to set employee access levels

alan_mitchell

Registered User.
Local time
Today, 13:46
Joined
Nov 25, 2008
Messages
11
[FONT=Verdana, Arial, Helvetica]Hi,

Here's the situation.

I have some VB code (GetUserName) which pulls in the username of the user from the Windows API. I then have a table which contains the desired access levels for each employee. The fields are:

* EmployeeName (text)
* AllowedAccessToControlA? (yes/no)
* AllowedAccessToControlB? (yes/no)
* AllowedAccessToControlC? (yes/no)

So for example, Joe Bloggs might be allowed access to A and B but not C.

I now want to make controls on a form visible/not visible based on these access levels. So if the user is Joe Bloggs, I would want to make controls A and B visible, but control C invisible.

So if I have a text box which contains the current username, I think I'll need a way to look up the AccessToControl columns.

I can't think of an easy way to do this but I'm sure there must be one. I've tried searching on Google but it's hard when I don't know what to search for! Any ideas to point me in the right direction?

Thanks for your help!

Alan
[/FONT]
 
When a user logs into the app you determine the who they are. You then look up there permissions in a table.

You also have a set of public variables, say

Public bolControlA As Boolean
Public bolControlB As Boolean
Public bolControlC As Boolean

You then pass the users rights to the coressponding variables.

Then in your form on the OnLoad event

Me.ControlA.Enabled = bolControlA
Me.ControlB.Enabled = bolControlB
Me.ControlC.Enabled = bolControlC

David
 

Users who are viewing this thread

Back
Top Bottom