Function to show Current User Group ..

  • Thread starter Thread starter m.cringle
  • Start date Start date
M

m.cringle

Morning folks!

Can anybody teel me if there is a function to display the user group of
the current user in a database with user-level security?

eg. Admins, Input-only ... etc.

Thanks
 
A user can be a member of more than one group, and frequently will be, as
all users are members of the built-in Users group. So whenever someone asks
about displaying the name of the user's group, we have to ask: 'Which one?'

Here's a function that will display a list of all groups of which the user
is a member ...

Public Function ListGroups(ByVal UserName As String) As String

Dim usr As User
Dim grp As Group
Dim strResult As String

Set usr = DBEngine.Workspaces(0).Users(UserName)
For Each grp In usr.Groups
strResult = strResult & grp.Name & vbNullChar
Next grp

ListGroups = strResult

End Function

Here's an example of it's use, in the Immediate Window ...

? listgroups(currentuser())
Admins Users

For a function to determine whether a user is in a specified group, see the
following discussion in the Google newsgroup archives ...

http://groups.google.com/group/microsoft.public.access/browse_frm/thread/e8058ff8a64bc21e
 
Brendan said:
A user can be a member of more than one group, and frequently will be, as
all users are members of the built-in Users group. So whenever someone asks
about displaying the name of the user's group, we have to ask: 'Which one?'


Hmmmm... I didn't think about that! Not an issue if all the groups are
displayed, probably better actually. Thanks for your help :-)
 
Sorry, I'm back!

Where would I put this code? I have made a splash-screen which
displays all the key system info and I wanted this to display in a
textbox on this splash-screen.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top