xanadude
Newbie - but learning fas
- Local time
- Today, 15:03
- Joined
- Feb 2, 2011
- Messages
- 65
Hi All
Firstly thanks for the help I have received so far - much appreciated but here is another
I am trying to create a call sub that checks a user id from the Environ("Username") and then change a variable to say that the user is valid or not.
I have it running by having a lot of If statements but would like to cut down on the overall content by having one list to lookup
This is what I have done so far - just is mess mode but the Variable AdminUser does not change when coming out of the Called Public Sub back to the main sub ?
I'm sure there is a easier way of doing this but as I am learning on the job to say getting myself lost quite easily..
thanks
Firstly thanks for the help I have received so far - much appreciated but here is another

I am trying to create a call sub that checks a user id from the Environ("Username") and then change a variable to say that the user is valid or not.
I have it running by having a lot of If statements but would like to cut down on the overall content by having one list to lookup
This is what I have done so far - just is mess mode but the Variable AdminUser does not change when coming out of the Called Public Sub back to the main sub ?
Code:
Private Sub TESTBUTTON_Click()
' Test button for security Access
AdminUser = -1
MsgBox [AdminUser]
Call CallRoutine
If AdminUser = -1 Then GoTo Pass
MsgBox "User Not Found"
MsgBox [AdminUser]
Exit Sub
Pass:
MsgBox "Found User"
MsgBox [AdminUser]
End Sub
Public Sub CallRoutine()
If Environ("Username") = "Roger.Goswell" Then Exit Sub
MsgBox "User Check"
AdminUser = 0
MsgBox [AdminUser]
End Sub
thanks
Last edited: