I hope someone can help me with an extrodinarily vexing problem. I've
searched Google high and wide and tried a number of methods for
determining if the current user is part of a specified group in A97. I
can find nothing in the otherwise excellent help files, except examples
of how to add users and specify what groups they are part of and adding
groups.
I have some code below from a post by Allen Browne in 2001 and it won't
work. When I put a break point at the start of the function and run
?IsUserInGroup(access.CurrentUser,"Users")
the code steps to For Each grp and grx and immediately goes straight to
setting the variables to nothing. I am logged into a secured DB as
Developer (member of every group) and I can't figure out what the blink
I'm doing wrong. SImilar things happen with other code snippets.
Please help me. Allen's code fallows.
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
--
Tim - http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Want some?" - Ditto