How to Make a Form Read Only on the bais of user login access level... (1 Viewer)

darno

Registered User.
Local time
Tomorrow, 01:42
Joined
May 25, 2005
Messages
67
Hi Folks,

I was wondering if there is a way to make a form read only, means Data Entry must not be allowed in that form. I have set up the database on user access according to their user level. 1 is for admin, 2, 3, and 4 are for other users.

My query is that if admin signs with level 1 the whole form should be available for ADD, EDIT, and DELETE, but if others log in then the form should not allow anykind of data entry into the form.


Regards,


Darno
 
hmm... i can think of a way to do it by basically setting button visible/enabled properties by checking a global variable for access level, but im sure there must be a better way of doing this. If no one else comes up with anything ill explain more
 
I believe Access has a built in user groups ability. You can set their read/write ability on the table the form is based on. You may even be able to set it up for the form itself.
 
heh :) knew there would be something easier than what i was thinking
 
You can set the properties when the form is opened. Not knowing how "you" define the level a user has signed on with so I guessed at this...
Code:
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
        
    If Level = "1" Then
        Me.AllowAdditions = True
        Me.AllowDeletions = True
        Me.AllowEdits = True
    Else
        Me.AllowAdditions = False
        Me.AllowDeletions = False
        Me.AllowEdits = False
    End If
        
Exit_Form_Open:
    Exit Sub
    
Err_Form_Open:
    MsgBox Err.Number & " - " & Err.Description
    Resume Exit_Form_Open
    
End Sub
If you were using true Access security with a workgroup then this is how it would look...
Code:
    If CurrentUser = "SystemAdmin" Then
        Me.AllowAdditions = True
        Me.AllowDeletions = True
        Me.AllowEdits = True
    Else
        Me.AllowAdditions = False
        Me.AllowDeletions = False
        Me.AllowEdits = False
    End If
*Admin is the default user name for the default System.mdw workgroup. All Admin rights must be removed if you are using Access security. Search the forum for more info on using Access workgroup security with user permissions.
 
ghudson,

The workgroup method you posted; I can't get it to work. I am logged in to the workgroup as a user with admin privs but it returns that I'm not? How to grab a list of groups within the workgroup and then the group(s) that the currently logged in user is a member of?

SOLUTION: http://www.access-programmers.co.uk/forums/showthread.php?t=121916
 
Last edited:

Users who are viewing this thread

Back
Top Bottom