From a parent form, you click a button that generates a new form in a new window. Here is the logic that needs to happen:
1. Form opens, grab some details about the child from the parent window to display.
2. As a user works, the record and child records save as usual.
3. At some point the user will click save which will add an actual account number to the page.
4. If the user navigates away from the page (closes the form, goes to another record) and there is no account number, ask the user if they want to save or discard their record. Saving populates the account number and discarding cleans up the record by deleting children and then the record itself.
I had this working fine when I was just dealing with one record. On form unload event I would check to see if the number was populated and then populate it or delete records based on their choice.
Then we started testing the moving from record to record and that event didn't work. In fact I still can't find an event that works. Some events are firing when the form opens initially.
If I had a LeaveRecord & EnterRecord event, I could do this all super easy.
I know this is just a case of me not understanding the naming for the events or how Access is trying to do things for me that I can't let it do (or I have to let it do and then undo or redo myself).
Everytime I think I have it 100% locked down, the event I'm expecting to fire doesn't fire or two events fire at once in an unexpected way and I get a message asking me to save on opening a record instead of leaving a record.