Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Function to show Current User Group ..

0 views
Skip to first unread message

m.cr...@gmail.com

unread,
Oct 16, 2006, 4:28:45 AM10/16/06
to
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

Brendan Reynolds

unread,
Oct 16, 2006, 4:59:57 AM10/16/06
to

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 Reynolds
Access MVP

<m.cr...@gmail.com> wrote in message
news:1160987325....@b28g2000cwb.googlegroups.com...

m.cr...@gmail.com

unread,
Oct 16, 2006, 5:48:07 AM10/16/06
to

Brendan Reynolds wrote:

> 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 :-)

m.cr...@gmail.com

unread,
Oct 16, 2006, 6:00:33 AM10/16/06
to
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

m.cr...@gmail.com

unread,
Oct 16, 2006, 6:51:31 AM10/16/06
to

No problem - sorted it now

0 new messages