.... or, if you prefer to do it the easy way, follow Jeff's and Klatuu's advice ;-)
-- Steve Schapel, Microsoft Access MVP
Steve Schapel wrote:
[Quoted Text] > Jesse, > > As far as I know, this is not directly possible. > > One way to handle this kind of requirement is to enforce that the only > way the application can be closed is via a command button on a form > which is always open when the application is open. The means of doing > this is like this... > > In the Declarations section at the top of the code module for the form, > put like this... > Dim AllowClose As Boolean > > On the Load event of the form, put... > AllowClose = False > > On your 'Exit' button, put... > AllowClose = True > DoCmd.Close acForm, Me.Name > DoCmd.Quit > > On the Unload event of the form, put... > If AllowClose Then > ' < your code that you want to run when the app closes > > Else > MsgBox "Use Exit button to close", vbExclamation, "Illegal escape" > Cancel = True > End If >
|