This is one way to do it:
VB Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) 'see if the person used the X, pressed Alt+F4, or selected Close from the control menu If UnloadMode = vbFormControlMenu Then 'if so, do your things here that you need to do 'stop the unloading by giving Cancel a nonzero value Cancel = True End If End Sub





Reply With Quote