CurrentUser's Group.

  • Thread starter Thread starter Andrew
  • Start date Start date
A

Andrew

In VBA how do I determine the CurrentUser's Group they are assigned to in the
Access WorkGroup file?
 
Andrew said:
In VBA how do I determine the CurrentUser's Group they are assigned to in
the
Access WorkGroup file?


A user may be in more than one group. You can, potentially, construct a
list of all the groups to which the current user belongs, or you can find
out whether a user belongs to a particular group in which you are
interested. When I have been concerned with this, my need was to know
whether the user was in the Admins group.

Here's a function you can call to find out if the current user is in a given
group:

'------ start of code ------
Function fncUserIsInGroup(GroupName As String) As Boolean

' Returns True if the current user is a member of the specified
' security group; False if not, or if the group doesn't exist, or
' if an error occurs reading the groups.

Dim ws As Workspace

Set ws = DBEngine.Workspaces(0)

On Error Resume Next
fncUserIsInGroup = _
(ws.Users(CurrentUser).Groups(GroupName).Name = GroupName)

Set ws = Nothing

End Function
'------ end of code ------
 
Thank-you Dirk.

This responce was extremely helpful. I needed to know the CurrentUser's
group with the highest level of user rights. What they can do in certain
fields is governed by enabling or disabling controls on a form. "Admins" can
do more things on some forms than "Officers" can. We have been using generic
IDs and passwords for each group, but management wants to go to indivisdual
IDs and passwords.
 
Back
Top