Get Windows Group info in code?

  • Thread starter AkAlan via AccessMonster.com
  • Start date
A

AkAlan via AccessMonster.com

How can I retrieve a users Windows group info from vba?
I have seen lots of samples out there but they all seem to only grab the
Access groups.
 
A

AkAlan via AccessMonster.com

Thanks for the post Marvin. I did find a way to do what I want that seems to
be a bit simpler than the code listed in the link you provided. I will post
it here for others to use. Do you see any issues with this method? Also now
that I can retrieve the users group info do you have any suggestions as to
how I would go about implementing form security. Specifically I was thinking
that I should only run this routine once and maybe populate global variables
then reference them to determine form security. Thanks for any suggestions.

Function IsUserInGroup(strUser As String, strGroup As String) As Boolean


Dim strUserName As String
strUserName = "WinNT://ars/" & strUser & ""
Set UserObj = GetObject(strTest)

For Each GroupObj In UserObj.Groups

If strGroup = GroupObj.Name Then IsUserInGroup = True

Next

Set UserObj = Nothing
Set GroupObj = Nothing

End Function
 
Top