G
Guest
I like code something like this:
In Module:
Option Compare Database
Option Explicit
Dim SwExit As Boolean
Public Sub AutoExec () ' Called in macro AutoExec
SwExit = False
DoCmd.OpenForm "frmNotToBeClosed Inadvertently"
End Sub
in frmNotToBeClosed Inadvertently:
Private Sub Form_Unload(Cancel As Integer)
Dim Rc
If WindowsIsClosing Then SwExit = True
If Not SwExit Then
Rc = MsgBox("You are about to close frmNotToBeClosed Inadvertently '" & _
vbCrLf & " " & _
vbCrLf & "Are you sure you want to close?" _
, vbExclamation + vbYesNo + vbDefaultButton2, _
"Closing Form")
If Rc <> vbYes Then Cancel = True
End If
End Sub
The question is how do I code function WindowsIsClosing?
Jos
In Module:
Option Compare Database
Option Explicit
Dim SwExit As Boolean
Public Sub AutoExec () ' Called in macro AutoExec
SwExit = False
DoCmd.OpenForm "frmNotToBeClosed Inadvertently"
End Sub
in frmNotToBeClosed Inadvertently:
Private Sub Form_Unload(Cancel As Integer)
Dim Rc
If WindowsIsClosing Then SwExit = True
If Not SwExit Then
Rc = MsgBox("You are about to close frmNotToBeClosed Inadvertently '" & _
vbCrLf & " " & _
vbCrLf & "Are you sure you want to close?" _
, vbExclamation + vbYesNo + vbDefaultButton2, _
"Closing Form")
If Rc <> vbYes Then Cancel = True
End If
End Sub
The question is how do I code function WindowsIsClosing?
Jos