Allow users different editing rights

CumbrianCanary

Registered User.
Local time
Today, 11:59
Joined
Sep 13, 2004
Messages
22
Can someone please help me out? I have a login form which asks for the users name and password and that all works fine. However, I then want to open a form giving them different editing rights depending on the access level I have assigned them. I have copied the code below. The intAccessLevel is being read in properly but when the form "Sample" opens it ignores the Me.Allow.... statements which corresponds to the different access levels. Does anyone have any ideas why this is the case?

Many thanks,
CC


intAccessLevel = DLookup("AccessLevel", "tblUsers", "[UserID]=" & Me.cboUserName)

If intAccessLevel = 1 Then
DoCmd.OpenForm ("Sample")
Me.AllowAdditions = True
Me.AllowDeletions = True
Me.AllowEdits = True
ElseIf intAccessLevel = 2 Then
DoCmd.OpenForm ("Sample")
Me.AllowAdditions = True
Me.AllowDeletions = False
Me.AllowEdits = True
ElseIf intAccessLevel = 3 Then
DoCmd.OpenForm ("Sample")
Me.AllowAdditions = True
Me.AllowDeletions = False
Me.AllowEdits = False
ElseIf intAccessLevel = 4 Then
DoCmd.OpenForm ("Sample")
Me.AllowAdditions = False
Me.AllowDeletions = False
Me.AllowEdits = False
End If
 
The me.allowadditions etc are not acting on the "Sample" form - they are operating on the form you use to open the "Sample" form

You need to move the code to the "Sample" form.


(Obvoiusly leaving DoCmd.OpenForm ("Sample") in the original form and removing it from "Sample")
 

Users who are viewing this thread

Back
Top Bottom