(Solved) – Form_Current in SubForm fires before other SubForm(s) update

(solved)-–-form-current-in-subform-fires-before-other-subform(s)-update

Scenario: Unbound master form with two subforms, both bound to tables that share the same ID. The subforms are tied together via an unbound field txtID=[SubForm1]![ID] on MasterForm and SubForm2 Link Master Fields = txtID & Link Child Fields = ID, as describes here. SubForm1 has record navigaion. SubForm2 always shows the record with the same ID as the record in SubForm1 (if any) = works as intended.

I implemented a routine to compare the records (which partially have the same data fields – unfortunately I’ve to work with these two data sources), highlighting differences – works as intended.

Problem: calling this comparison from Form_Current() in SubForm1 revealed unexpected behaviour: the event fires and the comparison is done before SubForm2 is updated (=> the comparison goes wrong).

Pausing code execution for some seconds before calling the comprison routine – I tested that out of curiosity – shows that sometimes the update of SubForm2 finishes before code execution continues, and sometimes not.

Leave a Reply

Your email address will not be published. Required fields are marked *