Find current Security Group of current user

  • Thread starter Thread starter Deano
  • Start date Start date
D

Deano

Does anyone know how to find out what the current Access users Security
group is. Its the security group created in Access not the NT domain.
(Access 2003)

Thanks in advance
 
A user could be a member of more than one group, but his example shows how
to loop through the group to see if the user is there:

Function IsUserInGroup(strUser As String, strGroup As String) As Boolean
'Returns True if the user is in the group.
'Example: IsUserInGroup(CurrentUser(), "Admins")
Dim wk As Workspace
Dim grx As Groups
Dim grp As Group
Dim usx As Users
Dim usr As User

Set grx = DBEngine(0).Groups
For Each grp In grx
If grp.Name = strGroup Then
Set usx = grp.Users
For Each usr In usx
If usr.Name = strUser Then
IsUserInGroup = True
Exit For
End If
Next
End If
Next

Set usr = Nothing
Set usx = Nothing
Set grp = Nothing
Set grx = Nothing
End Function
 
Thanks, that worked great !!!
Allen Browne said:
A user could be a member of more than one group, but his example shows how
to loop through the group to see if the user is there:

Function IsUserInGroup(strUser As String, strGroup As String) As Boolean
'Returns True if the user is in the group.
'Example: IsUserInGroup(CurrentUser(), "Admins")
Dim wk As Workspace
Dim grx As Groups
Dim grp As Group
Dim usx As Users
Dim usr As User

Set grx = DBEngine(0).Groups
For Each grp In grx
If grp.Name = strGroup Then
Set usx = grp.Users
For Each usr In usx
If usr.Name = strUser Then
IsUserInGroup = True
Exit For
End If
Next
End If
Next

Set usr = Nothing
Set usx = Nothing
Set grp = Nothing
Set grx = Nothing
End Function
 
Back
Top