I've got a main/subform.
The main form has a Close button, which does pretty much the same as the form's "X" close.
However, if the sub form is dirty, pressing the Close button first initiates the subform's Form_BeforeUpdate procedure.
In that, I can do a Me.undo, which is what I want as my Close button doesn't automatically save the record, it just ditches the changes to the record with a warning (explicit Save required to save a record).
The problem is that when the subform's Form_BeforeUpdate procedure finishes, control doesn't pass to the code for the Close button on the main form.
It's as if the Cancel is set, even though it's not.
Procedure processing just stops at the end of the same subform's Form_BeforeUpdate subroutine.
As a result, the whole close process is left stuck in a corrupted state.
I've tried this code in the sub form's procedure to give it a kick in the pants (thinking maybe one form could call another's procedure):
Code:
Forms(fCntl(3, 1)).Form_Close ' fCntl(3,1) contains the main form's name
but this produces RTE 2465.
Is there another way to do this call to the main form's Form_Close subroutine to keep the whole Close process running?
Note: Using the main form's "X" close, the processing goes straight to the main form's Form_Close procedure and bypasses the subform's Form_BeforeUpdate procedure. This causes the rest of the closing code to run without a problem.
In the image below, You can see the procedures that ran in the yellow Status textboxes.
In the subform, you can see that there isn't any more processing in the subform, the main form also doesn't show the Close_click.