You might want to consider using the QueryUnload event.
VB Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Select Case UnloadMode
Case vbFormControlMenu
strMess = "The user chose the Close command (the "X") from the Control menu on the form."
Case vbFormCode
strMess = "The Unload statement is invoked from code."
Case vbAppWindows
strMess = "The current Microsoft Windows operating environment session is ending."
Case vbAppTaskManager
strMess = "The Microsoft Windows Task Manager is closing the application."
Case vbFormMDIForm
strMess = "An MDI child form is closing because the MDI form is closing."
Case vbFormOwner
strMess = "A form is closing because its owner is closing."
End Select
End Sub