Hi,
It appears that it is firing, but for some reason nothing
gets done!!!! Here's my code, can anyone please point out
the problems. NB The msgbox "hi" in the first function
never appears. I am logged in as "Admin", and i'm coding
it this way because i don't have time to do the security
the proper way - it caused me problems! Also, it wouldn't
help me for this i don't think.
Many thanks,
Jonathan Stratford
Private Function findUserType() As String
Dim i As Integer
Call getUserArrays 'use call to ensure it's finished
before code continues
MsgBox "hi"
For i = 1 To 100
If CurrentUser = theLineManagers(i) Then
findUserType = "Line Manager"
Exit Function
ElseIf CurrentUser = theAdmins(i) Then
findUserType = "Admin"
Exit Function
Else 'if not admin or line manager must just be user
findUserType = "User"
Exit Function
End If
Next
End Function
Private Sub getUserArrays()
theUsers(1) = "User1"
theUsers(2) = "User2"
theLineManagers(1) = "Jonny"
theAdmins(1) = "Admin"
End Sub
Private Sub Form_Load()
Debug.Print "Form_Load for " & Me.Name & " at " & Now()
'use CurrentUser to determine whether a member of admin,
line managers or users
Dim usertype As String
usertype = findUserType
If usertype = "Admin" Then
cmdAddEmployee.Visible = True
cmdAddGroup.Visible = True
End If
If usertype = "Line Manager" Then
cmdAddEmployee.Visible = False
cmdAddGroup.Visible = False
End If
End Sub