lock form

krishnanhemanth

Registered User.
Local time
Tomorrow, 04:18
Joined
Jun 12, 2009
Messages
115
hi everybody

i have a db created in access 2007.
i want to make it multiuser by splitting the db in to front end and back end.
is it possible to set and grant permissions to users for editing or viewing or deleting depending on the user..


another area where iam stuck is ...
I want the entire form to be locked ( data edit disable ) when i click a checkbox. is it possible.
if yes ...should the checkbox be called from a table or can i use a checkbox on the form directly.

thanks in advance
krishnanhemanth
 
Yes, it is possible to set and grant permissions to users. You can either create a login form and associated tables to manage the users or another method would be to use the environ("username") to detect the user name from the windows logon.

Yes, you can use a form checkbox to manage accessibility to forms, controls, etc., for the user. You will have to store this in a table for the database to access.

You can do searches for any of this; however, here is a good start for a function that locks at the control level.

HTH,
-dK
 
thanks for the reply

what i have done is ...

i have made a table with user name and passwords stored in the table
i have created a login form and have made this form the startup form.
i need to grant permissions depending on the user that logs in
please help

hemanth
 
Okay, you could do this one of several ways, but I want to simplify it a bit more to give you an idea.

Suppose you added a couple of fields to your user table where the password and login are stored. One field is a LoggedIn (Yes/No) and another is called SecLevel (Text). For the security levels, lets put in something for one user - "Admin".

There are many, many ways to skin this cat - but I am going for a simple approach here (hidden forms for storing data, variables, etc.) On the login form, when the user succesffuly logs on, use VBA to set the LoggedIn field to 'True'. At this point I normally load up global variables for the user and security for the next steps, but will let you research that bit if you want to go that route. ;)

On the forms OnOpen event, you want to check that users table for who is logged in, their security level and do something about locking the form.

So it would probably look something like this ...

Code:
Dim sSecLvl As String
 
sSecLvl = Nz(DLookup("[SecLevel]","tUsersTableName", _
     "[LoggedOn = -1"), "None")
 
Select Case sSeclvl
Case "Admin"
     Me.AllowEdits = True
Case "None"
     MsgBox "There has been an error detecting the login.", , "Login Error"
     Me.AllowEdits = False
Case Else
     Me.AllowEdits = False
End Select

Now, we did this by the security level we assigned the user. This way you don't have to edit the select case statement in order to add a user - just assign the security level.

Now you could do this by adding a checkbox to the form and a field to the table feeding the form to control the form behavior and use the above to show/hide the field.

This is hardly optimized but usable to get your brain juices flowing and showing you but one method. You can check the link I posted earlier to see how you can potentially merge that with your login forms.

HTH,
-dK
 

Users who are viewing this thread

Back
Top Bottom