J
JoeRegulator
Hi.
I'm pretty new to programming in MS Access. I think this should be pretty
simple.
To prevent users from making accidental changes to a record and then
navigating away I've added code to the BeforeUpdate event of the form and I
test the Dirty property to find out if there have been changes. If there
have been I display a message box with the vbYesNoCancel buttons. If the
user selects yes then the record is saved and navigation proceeds. If no is
pressed the changes are not saved and navigation proceeds.
If the user presses cancel I want to stay on the current record and stay in
edit mode. How do I do that?
Here's the code I have so far;
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
Response = MsgBox("Changes have been made to the current mine record.
Do you want to save them before moving to the next record?", vbYesNoCancel,
"Confirm changes")
If Response = vbNo Then Me.Undoedit mode? <<<<<<<<<<<
End If
End Sub
Thanks for any help that you can provide.
I'm pretty new to programming in MS Access. I think this should be pretty
simple.
To prevent users from making accidental changes to a record and then
navigating away I've added code to the BeforeUpdate event of the form and I
test the Dirty property to find out if there have been changes. If there
have been I display a message box with the vbYesNoCancel buttons. If the
user selects yes then the record is saved and navigation proceeds. If no is
pressed the changes are not saved and navigation proceeds.
If the user presses cancel I want to stay on the current record and stay in
edit mode. How do I do that?
Here's the code I have so far;
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
Response = MsgBox("Changes have been made to the current mine record.
Do you want to save them before moving to the next record?", vbYesNoCancel,
"Confirm changes")
If Response = vbNo Then Me.Undoedit mode? <<<<<<<<<<<
End If
End Sub
Thanks for any help that you can provide.