opening a form on different levels

aneats

Registered User.
Local time
Today, 11:10
Joined
Nov 13, 2002
Messages
70
I have a database which, when opened, the user is promted to enter a username and password. depending on these details, forms are made available to a user on different levels, ie. manager enters u/name and p/w and gains access to the whole db, but user enters u/name and p/word and is only allowed to view forms 1, 2 and 3 (form 1 they have full access, form 2 they have input access only, and form 3 they have read only access). i have been able to do this so far, the trouble is that forms 2 and 3 have command buttons on them that open other forms (which i don't want them to be able to manipulate), so i want to be able to disable these buttons, but only when the restricted user is using the form, ie: if i have disabled buttons on the form, and the manager opens it, these buttons need to be enabled.
 
Firstly how have you implemented the security?

Did you use Access User-level security or did you devise your own and store permission levels etc. in public variables
 
I have created a form called 'Password' with 2 boxes, user name and password. The user enters these and behind the 'OK' button i have set code along the lines... if username is X and password is Y, then open main form, else if user name is Z and password is W, then open staff form. the staff form has 3 buttons, and the code behind these dictates whether they are read only, input only or full access.
i have tried access user- level security before, and i'm not touching it again!
 
Hi

Assuming you have one manager you could check the username and then enable / disable the buttons appropriately

Select Case txtUserName

Case "Joe Bloggs"
cmdMyButton.Enabled = True
Case Else
cmdMyButton.Enabled = False
End Select

Place this in your form's On_Open event

Alternatively you could do like I have done and create a login form where you users enter their username and password and then use the DLookup function to return the permission level to a public variable. Then in each of your forms you can compare this variable to a declared constant to see if the user has permission to access all of the form's functions.

I have an example of the login code if you want it.

HTH
Rob
 

Users who are viewing this thread

Back
Top Bottom