Show User Group

CutAndPaste

Registered User.
Local time
Today, 00:54
Joined
Jul 16, 2001
Messages
60
Show User Group on Form - how?

I've got User Level Security and want to show the logged on User which Group they are logged in as on a Form at Start up. I'm already showing a message using CurrentUser() to show their name but I'd also like to show their User Group (the Groups are hierachical so users rte only ever a member of one group).

Can this be done?

thanks,

Simon
 
showing groups

This code can show whether a user is in an intended group. It should be possible to convert it to match your requirements.

** Not my code ** .. if anyone knows the original author please post.

Function UserInGroup(GroupName)
' Check if the current user is in the chosen group

Dim w As Workspace
Dim U As User
Dim g As Group
Dim gname As String

' Read users object for the current user (wuking grate array!)
Set U = DBEngine.Workspaces(0).Users(CurrentUser)

On Error Resume Next
gname = U(GroupName).Name ' Name from groups list
If gname = GroupName Then
' User in the right group, return success
' MsgBox (CurrentUser & " is a member of " & GroupName)
UserInGroup = True
Else
' User not in right group, return failure
' MsgBox (CurrentUser & " not member of " & GroupName)
UserInGroup = False
End If
End Function
 

Users who are viewing this thread

Back
Top Bottom