P
PeterM
I have a AC2003 bound form. The condition I'm trying to capture is if the
user modifies any item on the form and they close the form without saving
changes. Simple...right? I found out that Form_Close doesn't work so I
tried the following code in the Form_Unload event and that isn't working
either. It does not even trigger the event. Can someone please tell me what
I'm doing wrong? I would be much appreciated.
Private Sub Form_Unload(Cancel As Integer)
If Me.btnSave.Enabled Then
Dim strMsg As String
strMsg = strMsg & "Save Changes?" & Chr(13) & Chr(13)
If MsgBox(strMsg, vbQuestion + vbYesNo, "Please Confirm!") = vbYes
Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
Else
Cancel = True
End If
End If
End Sub
user modifies any item on the form and they close the form without saving
changes. Simple...right? I found out that Form_Close doesn't work so I
tried the following code in the Form_Unload event and that isn't working
either. It does not even trigger the event. Can someone please tell me what
I'm doing wrong? I would be much appreciated.
Private Sub Form_Unload(Cancel As Integer)
If Me.btnSave.Enabled Then
Dim strMsg As String
strMsg = strMsg & "Save Changes?" & Chr(13) & Chr(13)
If MsgBox(strMsg, vbQuestion + vbYesNo, "Please Confirm!") = vbYes
Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
Else
Cancel = True
End If
End If
End Sub