A thread in a different forum went off on a tangent, and I think my resulting question would be better asked here.
I have a form that contains a bunch of fields all related to one database record at a time. I would like to have a confirmation message box appear before moving to a different record. I added this code in the Before Update section of the form properties:
My problem is this: Right now, if someone inadvertently makes a change to one of the fields and doesn't know what it was, he or she cannot just discard the changes and move to another record--rather, the user must go through a clumsy way of exiting the database without saving.
Is there any way to set up code like the above such that, once a change is made, a Yes moves to the next record while saving changes, but a No moves to the next record without making the changes?
Thanks in advance.
I have a form that contains a bunch of fields all related to one database record at a time. I would like to have a confirmation message box appear before moving to a different record. I added this code in the Before Update section of the form properties:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
If MsgBox("This record has been changed. Are you sure it's okay to proceed?", vbYesNo) = vbNo Then
Cancel = True
End If
End If
End Sub
If Me.Dirty Then
If MsgBox("This record has been changed. Are you sure it's okay to proceed?", vbYesNo) = vbNo Then
Cancel = True
End If
End If
End Sub
My problem is this: Right now, if someone inadvertently makes a change to one of the fields and doesn't know what it was, he or she cannot just discard the changes and move to another record--rather, the user must go through a clumsy way of exiting the database without saving.
Is there any way to set up code like the above such that, once a change is made, a Yes moves to the next record while saving changes, but a No moves to the next record without making the changes?
Thanks in advance.