Exit Code

Dina01

Registered User.
Local time
Today, 19:47
Joined
Apr 24, 2002
Messages
87
Hello,

I have the following code in my form, but I need the code to loop when the user, doesn't have access to the PC...Right know what happens is that when the user doesn't have access I get the message "YOU DON'T HAVE ACCESS FROM THIS PC" and it still logs him in. I want it to EXIT and not log him in........I am not to sure if I need a loop...

This is the code
**********************
'Specifies codes to agents
If Me![CompCycle].Column(0, 0) <> "" Then

strComputerName = Me![CompCycle].Column(0, 0)

If strComputerName = "1" Then
MsgBox ("I AM A CONTROLLER")

ElseIf strComputerName = "2" Then
MsgBox ("I AM A VOUTER")
ElseIf strComputerName = "3" Then
MsgBox ("I AM A PRINCESS THE ONE AND ONLY")
Else
'NOTHING

End If
Else
MsgBox ("YOU DON'T HAVE ACCESS FROM THIS PC")


End If
 
Use Select Case

You need to exit the code if the combo column is null. Then the combo must be updated with a valid entry before the code will run to a conclusion :

If Me![CompCycle].Column(0, 0) = "" Then
MsgBox ("YOU DON'T HAVE ACCESS FROM THIS PC")
Exit Sub
End if

strComputerName = Me![CompCycle].Column(0, 0)

Select Case strComputerName
Case is = "1"
MsgBox ("I AM A CONTROLLER")

Case is = "2"
MsgBox ("I AM A VOUTER") '????

Case is = "3"
MsgBox ("I AM A PRINCESS THE ONE AND ONLY") 'Hmmm....

Case Else
'NOTHING

End Select

....................... Rest of your code

End sub
 
Last edited:

Users who are viewing this thread

Back
Top Bottom