Security-User Selections

  • Thread starter Thread starter quixote
  • Start date Start date
Q

quixote

I have an app where users log in. On one of my forms I
have a drop down box where users can change the status of
a record. I would like to find a way where only one or two
users (based on user name)can change the status of a
record to "Approved" (this is one of 4-5 options). I don't
want other users to have this option.
Any ideas?
Thanks
 
I would go about this by creating a Group (e.g.Approvers)
and placing these users in that group.

Then you can add a function to the form to determine if the
current user is in this group e.g.
Private Function IsApprover() As Boolean
Dim varTemp As Variant
On Error GoTo lbl_err

varTemp =
DBEngine.Workspaces(0).Users(CurrentUser()).Groups("Approvers").Name
IsApprover = True
Exit Function

lbl_err:
IsApprover = False

End Function

Then, in the form's Load eventhandler, I would construct
the drop-down list depeneding upon whether the current user
is an approver e.g.
Private Sub Form_Load()
If IsApprover Then
Me.cmbStatus.RowSource =
"Approved;Declined;Deferred;Pending"
Else
Me.cmbStatus.RowSource = "Declined;Deferred;Pending"
End If
End Sub

Hope This Helps
Gerald Stanley MCSD
 
Back
Top