I am trying to limit access to something by Organizational Department or Team Name. I know that you can access the username (Application.BasicFunctions.SystemInfoFor(UserName)) but how do I get the Organizational Department or Team Name of the user who is currently logged in?
This is a function created by Ryan Farley to determine the Users Department or Team.
' sGroupType = "T" for team, and "D" for department
Function IsMember(ByVal sUser, ByVal sGroup, ByVal sGroupType)
If sGroupType = "T" Then sGroupType = "G"
Set objRS = CreateObject("ADODB.Recordset")
Set .ActiveConnection = Application.GetNewConnection
.Open "select accessid from secrights where seccodeid = " & _
"(select seccodeid from seccode where (seccodedesc = '" & sGroup & "') " & _
"and (seccodetype = '" & sGroupType & "')) and (accessid = '" & sUser & "')"
If Not (.EOF Or .BOF) Then
IsMember = (.Fields(0).Value & "" = sUser)
IsMember = False
Set objRS = Nothing