Setting Employee Access Levels

  • Thread starter Thread starter alan_mitchell
  • Start date Start date
A

alan_mitchell

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.

I can't think of an easy way to do this but I'm sure there must be one. Any
ideas?

Thanks for your help!

Alan
 
You really should implement User-Level Security (ULS) on your db from there
you will be able to control what each user or group can view\edit\...

Don't reinvent the wheel. The tool already exist. Look it up in the help
file or online there is tons of information on the subject and it is easy to
setup and use.
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
Rick Brandt said:
In the OpenEvent of the form...

Me.ControlA.Visible = DLookup("AllowedAccessToControlA",_
"TableName",_
"EmployeeName = '" & GetUserName() & "'")
Me.ControlB.Visible = DLookup("AllowedAccessToControlB",_
"TableName",_
"EmployeeName = '" & GetUserName() & "'")
Me.ControlC.Visible = DLookup("AllowedAccessToControlC",_
"TableName",_
"EmployeeName = '" & GetUserName() & "'")

This is a simple example. I generally avoid making multiple consecutive
domain aggregate calls so more likely I would use a Recordset object so I
could retrieve all three values with one query instead. The concept is
the same though.


Thanks Rick - it worked a treat!

Cheers,
Alan
 
Back
Top