Any way to enforce subfrom edits from main form
Posted on 2017-10-12
In my Access 2013 application I have a mainform 'frmDocumentDefinition' with two subforms 'frmDocumentInterestedParties_Sub' and 'frmDocumentTriggeredCosts_Sub' on it.
The two subforms are continuous forms. Within the subforms I have an edit routine in the 'before update' event for each record entered or updated on the subforms to make sure that all required fields have been entered on each line. The edits work and put out messages for any errors encountered. While working only in the subform the user cannot go to another line until all the edits for the current line are passed.
The problem occurs when users clicks anywhere on the main form while working on an incomplete line in one of the subforms. When that occurs:
The subform edits are invoked and any subform error messages are displayed " Cost Date is a required field."
However, after the error message from the subform is displayed the focus shifts to the main form. The bound subform record is saved but it has the errors in it. For example: required fields are blank.
How do I stop the subform from losing focus when there are edit errors on the subform?
How can I make sure the edits on the subforms are enfoorced from the the main form?