Zydeceltico
Registered User.
- Local time
- Today, 09:56
- Joined
- Dec 5, 2017
- Messages
- 843
Hi. You don't need to reach back to form 1 because you already passed the ID to form 2, you should be able to use the same information to delete the unwanted record.
I never figured out how to do this elegantly.
On a given secondary form's "Save" button I have this
RunCommand acCommandSaveRecord
DoCmd.Close
And then on each secondary form's Unload event I have
DoCmd.Close acForm, "frmInspectionEvent", acSaveYes
So I tried putting all of that code on click event of the Save button like this:
DoCmd.Close acForm, Me.Name, acSaveYes
DoCmd.Close acForm, "frmInspectionEvent", acSaveYes
And then made a "Cancel" button that has this code on the click:
DoCmd.Close acForm, Me.Name, acSaveNo
DoCmd.Close acForm, "frmInspectionEvent", acSaveNo
This works for not saving the secondary form but the record is still saved to the table of the original calling form.
Is there some other syntax I can use to replace DoCmd.Close acForm, "frmInspectionEvent", acSaveNo so that record from the calling form is deleted?
I have this code on the original calling form's Before Update event:
Code:
If Me.Dirty Then
If MsgBox ("Do you want to continue?", vbYesNo + vbQuestion, "Save Record" = vbNo Then
Me.Undo
End If
End If
Is there something like this I can put on the calling form's Close or Unload event that asks "Do you want to save?" and if I click No it will delete the current record in the table of the calling form?
Remember Form1 (calling form) and Form2 (secondary form) are both open at same time.
Thanks!
Tim