T
tkosel
I have this code in a forms unload event. (V_Password is a Public Variable)
My purpose is to prevent the user from exiting the application using any
method I do not approve of. (Such as X control button, etc. My reason for
this is that the application runs continously in the background, no user
input is required. However, if it isn't running due to some user closing it,
it won't do what it is supposed to!) Of course I want to have a way out
myself, so If I have the password, I can exit.
Private Sub Form_Unload(Cancel As Integer)
DoCmd.OpenForm "PasswordForm", , , , , acDialog
If V_Password = "test" Then 'go ahead and quit, allow the event to
complete
GoTo Done
Else 'don't quit, cancel the unload event
Cancel = True
Exit Sub
End If
Done:
Exit Sub
End Sub
It works, except Access 2007 gives me the typical message about how it has
encountered a problem and needs to close. "Sorry for the inconvienience!"
Asks if I want to send or not and when I click debug, I get no dialog.
Kind of irritating, any ideas what causes this and why? How can I eliminate
it? This application will be using the Access 2007 Runtime when it is
deployed, but testing it using Access 2007 full.
My purpose is to prevent the user from exiting the application using any
method I do not approve of. (Such as X control button, etc. My reason for
this is that the application runs continously in the background, no user
input is required. However, if it isn't running due to some user closing it,
it won't do what it is supposed to!) Of course I want to have a way out
myself, so If I have the password, I can exit.
Private Sub Form_Unload(Cancel As Integer)
DoCmd.OpenForm "PasswordForm", , , , , acDialog
If V_Password = "test" Then 'go ahead and quit, allow the event to
complete
GoTo Done
Else 'don't quit, cancel the unload event
Cancel = True
Exit Sub
End If
Done:
Exit Sub
End Sub
It works, except Access 2007 gives me the typical message about how it has
encountered a problem and needs to close. "Sorry for the inconvienience!"
Asks if I want to send or not and when I click debug, I get no dialog.
Kind of irritating, any ideas what causes this and why? How can I eliminate
it? This application will be using the Access 2007 Runtime when it is
deployed, but testing it using Access 2007 full.