Derek
11-22-2007, 05:29 AM
Hi
I wonder if you can help me (as you have done so well for me in the past!).
I am using the undernoted code (amongst a bundle of other code) to ensure that only authorised users can get access to an excel file. I am doing this is 3 levels - password, computername and where a file is recognised as being on the user's pc/laptop. The password code runs elsewhere and is fine. The code below is a "test" code for the other two stages. When it recognsises that the computername is ok and the file is there, it works fine. When it fails to recognise the username, I get the error message but the application does not close down, it moves on to the second check, and when it finds the file I get the success message - but then the application closes down. Why does it not close down at the first error??
If Environ("computername") = "DMONEY" Or Environ("computername") = "DMONEY." _
Or Environ("computername") = "FARQY" Or Environ("computername") = "FARQY." Then
MsgBox "Success1"
Else
MsgBox "Fail1"
Application.DisplayAlerts = False
Application.Quit
End If
If FileFolderExists("C:\Database\client\FIFdata.mdb") Then
MsgBox "Success2"
Else
MsgBox "Fail2"
End If
End If
Your help as always is appreciated greatly
Derek
I wonder if you can help me (as you have done so well for me in the past!).
I am using the undernoted code (amongst a bundle of other code) to ensure that only authorised users can get access to an excel file. I am doing this is 3 levels - password, computername and where a file is recognised as being on the user's pc/laptop. The password code runs elsewhere and is fine. The code below is a "test" code for the other two stages. When it recognsises that the computername is ok and the file is there, it works fine. When it fails to recognise the username, I get the error message but the application does not close down, it moves on to the second check, and when it finds the file I get the success message - but then the application closes down. Why does it not close down at the first error??
If Environ("computername") = "DMONEY" Or Environ("computername") = "DMONEY." _
Or Environ("computername") = "FARQY" Or Environ("computername") = "FARQY." Then
MsgBox "Success1"
Else
MsgBox "Fail1"
Application.DisplayAlerts = False
Application.Quit
End If
If FileFolderExists("C:\Database\client\FIFdata.mdb") Then
MsgBox "Success2"
Else
MsgBox "Fail2"
End If
End If
Your help as always is appreciated greatly
Derek