Syntax

G

Guest

What is the proper Syntax for using the
IsUserInGroup Function in a Form's Open Event Here is my current Syntax but
I am getting the following


error message: Expected End Sub

Private Sub Form_Load()

Function faq_IsUserInGroup(strGroup As String, strUser As String) As Integer
' Returns True if user is in group, False otherwise
' This only works if you're a member of the Admins group.

Dim ws As Workspace
Dim grp As Group
Dim strUserName As String

Set ws = DBEngine.Workspaces(0)
Set grp = ws.Groups(strGroup)
On Error Resume Next
strUserName = ws.Groups(strGroup).Users(strUser).Name
faq_IsUserInGroup = (Err = 0)


If faq_IsUserInGroup("Regulatory", CurrentUser) Then
Me.Add_Review_Employee_Information.Visible = True
Me.cmdViewTraining.Visible = True
Me.cmdReviseSops.Visible = True
Me.cmdAddBpr.Visible = True
Me.cmdRunReports.Visible = True
Me.cmdAddLotNumber.Visible = True
Me.cmdExit.Visible = True
Else
Me.cmdAddLotNumber.Visible = True
Me.cmdRunReports.Visible = True
Me.cmdExit.Visible = True
End If
End Function
End Sub

Should the function be entered in as a Module in the Form Code?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top