Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Identifying the groups a user is a member of. 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have several forms that only show certain fields depending on which user is logged on. This works fine but to cut down on adding and deleting users I would like the code to look at what groups a user is in and then that would determine what fields are visible.

At present:

If CurrentUser = "fred.bloggs" Or CurrentUser = "john.smith" then
txtMyTextbox.visible = True
else
txtMyTextbox.visible = False

I would like it to say if CurrentUser is in Admins group then ........

Any Idea's

Thanks

Trium
 
this is a funtion i use to determin if the current user is a member of the admins group...



if checkadmin = true
'then the person is a membor, so run what ever you want
else
'the current user is not a membor of the admins group...
end if




Public Function checkAdmin() As Boolean

Dim grp As Group
Dim i As Integer
Dim Flag As Integer

Set grp = DBEngine.Workspaces(0).Groups("Admins")
Flag = 0

For i = 0 To grp.Users.count - 1
If CurrentUser = grp.Users(i).name Then
Flag = 1
End If
Next i

If Flag = 1 Then
checkAdmin = True
End If


End Function

Hope this helps...

--James
junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top