Thank you for all you pointers - I've corrected errors, added Option explicit and error handling to all subs and functions. It hasn't changed a bit, though.
Actually I think the issue is much simpler than it seems - it has nothing to do with my code really. All what this is about boils down to this public variable
Code:
Public filter As clsFilter
in "factory" module. It keeps the pointer to the instance of clsFilter I created. We have to consider 2 cases:
- All forms (including filter's main form & its subform) are created during the runtime of code
- Forms are present (hence not created once more)
At 1) factory.filter holds the pointer to the instance of clsFilter as long as sub "xxx" runs. When it ends, something happens that turns factory.filter to Nothing
at 2) factory.filter holds the pointer to the instance of clsFilter even after "xxx" has finished.
This is the real source of the problem. In spite of the fact that main filter form opens as soon as it's called, it starts displaying anything after the main sub ("xxx") has finished. I did some loop to prove it. The loop took about 15 seconds to finish, main filter form appeared right away as usual (but it was all blank form with only the title bar) and all the subforms loaded after 15 seconds when "xxx" has finished..
Why factory.filter is turned to "Nothing" in case 1? I don't do that in code anywhere, so it must be associated to the way new form are being saved and opened..
Robert