Searching google for "isingroup", I found the following. Some of these may
help you do what you want. I have not tested any of this.
Rick B
---------------------------------------------------------------
In a standard code module paste this code:
CODE
Public Function IsInGroup(Target, Pattern) As Boolean
If Nz(Pattern, "*") = "*" Then IsInGroup = True: Exit Function
Dim i As Long
For i = 1 To Len(Pattern)
If InStr(Target, Mid(Pattern, i, 1)) > 0 Then
IsInGroup = True: Exit Function
End If
Next i
End Function
---------------------------------
Go to the following link and do a 'find' on the page. There is a link about
halfway down the page that will take you to an actual sample database with
the code built in.
http://www.rogersaccesslibrary.com/OtherLibraries.asp
The link is called, "Function IsInGroup Sample Database (IsInGroup.mdb) (8
KB) Access 97 "
---------------------------------
Check this out...
Here's a link to a previous discussion on this subject. It includes the code
for a 'IsInGroup' function that will return True if the specified user is in
the specified group ...
http://www.google.com/[email protected]
---------------------------------
You can do this...but it often result in a LOT of work.
I usually hide all of the ms-access bars.
Then, for my own menus like special options (to add new users etc), I simply
remove the permissions form the form. Then, users that don't have
permissions simply can't use those forms. Not a very friendly default
message is given...but then again users quickly learn that they simply can't
use certain options. This approach saves tons of coding on your part. And,
further..you should be hiding all of the built in tool bars anyway.
However, if you must, you could use some start-up code like:
if IsInGroup(CurrentUser,"SuperUser" then
CommandBars("menu bar").Controls("records").Controls("refresh").Visible
= True
end if
\
if IsInGroup(CurrentUser(),"InvoideDeleteGroup") = true then
CommandBars("myCustomBar").Controls("AdminOptions").Controls("DleeteInvoice"
).Visible = True
end if
You then need the folwign code IsInGroup in a global modeule:
Public Function IsInGroup(UsrName As String, GrpName As String) As Boolean
'Determines whether UsrName is a member of GrpName
Dim grp As Group
Dim IIG As Boolean
Dim usr As user
IIG = False
For Each usr In DBEngine.Workspaces(0).Users
If usr.Name = UsrName Then GoTo FoundUser
Next
GoTo IIG_Exit
FoundUser:
For Each grp In usr.Groups
If grp.Name = GrpName Then IIG = True
Next
IIG_Exit:
IsInGroup = IIG
End Function