Logic of subform loading

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TheSmileyCoder
    Recognized Expert Moderator Top Contributor
    • Dec 2009
    • 2322

    Logic of subform loading

    I remember when I first started Access that I found alot of the behavior of access to be idiotic. However with experience I have since learned that what used to be idiotic actually does make sense when you get to know access better.

    One of those things that still elude me to a point is the loading behavior of forms.

    Imagine 2 forms, a Main form and a subform. The subforms Open, Load, and Current event fires BEFORE the main forms Open, Load and Current (In order listed).

    Why is that? Anyone know?
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    In addition:
    1. The Activate() Event doesn't occur for Subforms, so opening a Main Form triggers an Activate() event only for the Main Form.
    2. When you close a Form containing a Subform, the Subform and its Records are unloaded after the Form.
    3. The Deactivate() Event doesn't occur for Subforms, so closing a Main Form triggers a Deactivate() Event only for the Main Form.

    Comment

    • Rabbit
      Recognized Expert MVP
      • Jan 2007
      • 12517

      #3
      Open fires after a form is opened but before records are displayed. So it's really After Open. So as it's opening the main form and loading all the controls, it must fully open and load the subform before the main form can be considered fully opened.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32661

        #4
        As Rabbit says.

        Also notice that the Open event for the form has a Cancel option. I suspect the subforms need to be fully available at this stage in case continuation is dependent on data within them.

        @ADezii subforms are never activated or deactivated as that would make little sense. For the same reason they never appear in the Forms collection.

        Comment

        Working...