Enabling controls based on user group

  • Thread starter Thread starter RipperT
  • Start date Start date
R

RipperT

I am trying to figure out how I can check if the CurrentUser is a member of
a specific group and enable/disable a button based upon it. Can anyone get
me started? What I've tried appears to be far from what I need.

Thx,

Rip
 
A user can be members of multiple groups, so you cannot start with the user
and discover what their group is. You must start with the group, and see if
the user is a member.

The code to do that looks like this:

Function IsUserInGroup(strUser As String, strGroup As String) As Boolean
Dim varDummy As Variant
On Error Resume Next
varDummy = DBEngine(0).Users(strUser).Groups(strGroup).Name
IsUserInGroup = (Err.Number = 0)
End Function
 
Back
Top