Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Function UserBelongsToGroup(strGroupName As String, Optional varCurrentUser As Variant) As Boolean
'********************************
'* Declaration Specifications *
'********************************
Dim wsp As Workspace
Dim grp As Group
Dim usr As User
Dim i As Integer
Dim bolAnswer As Boolean
Dim strCurrentUser As String
'****************
'* Initialize *
'****************
On Error GoTo ErrHandler
bolAnswer = False
If (IsMissing(varCurrentUser)) Then
strCurrentUser = CurrentUser
Else
strCurrentUser = CStr(varCurrentUser)
End If
Set wsp = DBEngine.Workspaces(0)
Set grp = wsp.Groups(strGroupName)
Set usr = wsp.Users(strCurrentUser)
'******************************************************************
'* Loop to determine if the User is part of the group specified *
'******************************************************************
For i = 0 To grp.Users.Count - 1
If grp.Users(i).Name = usr.Name Then
bolAnswer = True
GoTo ExitProcedure
End If
Next i
' wsp.Close
'********************
'* Exit Procedure *
'********************
ExitProcedure:
UserBelongsToGroup = bolAnswer
Exit Function
'****************************
'* Error Recovery Section *
'****************************
ErrHandler:
If Err = 3265 Then
MsgBox UCase(strGroupName) & " isn't a valid group name", vbExclamation
ElseIf Err = 3029 Then
MsgBox "The account used to create the workspace does not exist", vbExclamation
Else
MsgBox Err.Description, vbExclamation
End If
wsp.Close
GoTo ExitProcedure
End Function