Hi all,
I have a database with security that allows four levels of access, (e.g.,Admin, Power User, Project Manager, and Guest) which are associated with a value (AccessID) of 1, 2, 3, and 4 respectively.
The security seems to work fine except on a form that uses a call function on the double click event of a txtcontrol to pop up a calender to select a date.
I was wondering if there is a way to turn the call statement off via code. In this case if the User.AccessID = 4 do not allow the call to occur.
For example if the security level is read only (4) then either the double click event should be turned off somehow or the call function should not fire. I suspect I would have to put code on each control that pops up the calender,
Me.ProjectStartDate
Me.ProjectEndDate, etc.
Here is a sample of the on open code I am using.
I have a database with security that allows four levels of access, (e.g.,Admin, Power User, Project Manager, and Guest) which are associated with a value (AccessID) of 1, 2, 3, and 4 respectively.
The security seems to work fine except on a form that uses a call function on the double click event of a txtcontrol to pop up a calender to select a date.
I was wondering if there is a way to turn the call statement off via code. In this case if the User.AccessID = 4 do not allow the call to occur.
For example if the security level is read only (4) then either the double click event should be turned off somehow or the call function should not fire. I suspect I would have to put code on each control that pops up the calender,
Me.ProjectStartDate
Me.ProjectEndDate, etc.
Here is a sample of the on open code I am using.
Code:
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
If User.AccessID = 1 Or User.AccessID = 2 Then
'Here list all buttons and controls that should be enabled for level 1 and 2
Me.AllowEdits = True
Me.AllowAdditions = True
Me.AllowDeletions = True
Else
'Here list all buttons and controls that should be enabled for level 3 only
If User.AccessID = 3 Then
Me.AllowEdits = False
Me.AllowAdditions = True
Me.AllowDeletions = False
Else
'Here list all buttons and controls that should be enabled for level 4 only
If User.AccessID = 4 Then
Me.AllowEdits = False
Me.AllowAdditions = False
Me.AllowDeletions = False
End If
End If
End If
Exit_Form_Open:
Exit Sub
Err_Form_Open:
MsgBox Err.Description
Me.Visible = True
Resume Exit_Form_Open
End Sub