Hi Everyone,
I have a form, named MyParent, that contains an Add/Edit and a Cancel button on it. The form also contains a subform, named MySubForm.
In the MySubForm Form_BeforeUpdate event, I have added a few edit checks which launch a MessageBox that contains the appropriate error message. I have also added a MsgBox in the BeforeUpdate that asking the user if they want to save their changes.
Here is my problem:
If the user adds or edits a records and then clicks on the Cancel button, btnCancel, because they do not want to save their changes, my edit checks from the BeforeUpdate event fire off and prevent the user from canceling their changes.
Is there a way to capture the Cancel button click event from MyParent in the MySubForm code?
My thoughts were to try something like this in the MySubForm BeforeUpdate event:
Thanks,
Crhodus
I have a form, named MyParent, that contains an Add/Edit and a Cancel button on it. The form also contains a subform, named MySubForm.
In the MySubForm Form_BeforeUpdate event, I have added a few edit checks which launch a MessageBox that contains the appropriate error message. I have also added a MsgBox in the BeforeUpdate that asking the user if they want to save their changes.
Here is my problem:
If the user adds or edits a records and then clicks on the Cancel button, btnCancel, because they do not want to save their changes, my edit checks from the BeforeUpdate event fire off and prevent the user from canceling their changes.
Is there a way to capture the Cancel button click event from MyParent in the MySubForm code?
My thoughts were to try something like this in the MySubForm BeforeUpdate event:
Code:
If Me.[MyParent].Field!btnCancel.Click = True Then
''// Cancel changes made to record.
Me.Undo
Else
''// Execute Edit Checks.
End If
Thanks,
Crhodus