Restrict by workgroup

  • Thread starter Thread starter April
  • Start date Start date
A

April

I apologize if this was covered earlier - I tried to do a
search, but rec'd a System Error.

Anyway, I would like to be able to restrict use of an
Access .mdb based on workgroups. I understand the use of
users/workgroups under the Security menu option; what I'm
looking for it something equivalent to the CurrentUser
method (such as CurrentWorkgroup). I'd like to be able to
check the current workgroup of the logged in user and
enable/disable things in forms based on the results; e.g. I
want to be able to "allow deletions" by Supervisors, but
not by Workerbees (and other similar things).

Any guidance out there? (I'd rather not have to check for
CurrentUser being equal to a number of different users.)

Thanks, in advance.
April
 
Use the following function (from the Security FAQ) to check if a user is in
a given group.

Function faq_IsUserInGroup (strGroup As String, strUser as String) As
Integer
' Returns True if user is in group, False otherwise
' This only works if you're a member of the Admins group.
Dim ws As WorkSpace
Dim grp As Group
Dim strUserName as string

Set ws = DBEngine.Workspaces(0)
Set grp = ws.Groups(strGroup)
On Error Resume Next
strUserName = ws.groups(strGroup).users(strUser).Name
faq_IsUserInGroup = (Err = 0)
End Function
 
Back
Top