[AccessD] How to control subforms loading order?

Christopher Hawkins clh at christopherhawkins.com
Thu Jun 5 10:38:46 CDT 2003


Sure.  Given main form frmMain, first subform sfrmFirst, and second
subform sfrmSecond:


1) Place an empty subform control on frmMain and sfrmFirst.  When I
say empty I mean, the SourceObject property of the control should be
blank.

2) frmMain_OnLoad should set the .SourceObject property of it's blank
subform control to 'sfrmFirst'.

3) sfrmFirst_OnLoad should set the .SourceObject property of it's
blank subform control to 'sfrmSecond'.

4) Filter as needed.

Curious; why are you synchronizing the two subforms via the Filter
property instead of the Child/Parent properties provided for that
purpose?

-C-

---- Original Message ----
From: Philippe.Pons19 at wanadoo.fr
To: AccessD at databaseadvisors.com, 
Subject: RE: [AccessD] How to control subforms loading order?
Date: Thu, 5 Jun 2003 17:19:29 +0200

>Hi,
>
>I have a form with two embedded subforms.
>
>On the OnCurrent event of the first subform, I synchronise the 
>second one using the Filter and OnFilter properties of it.
>This works fine, but generates an error the first time the Form is 
>loaded.
>This is because I reference the second subform, but at this time it 
>is not yet loaded.
>
>I found a workaround by removing the first subform from the main 
>form and reinserting it, as it seems Access loads the subforms in 
>the same order at which they have been inserted.
>
>However, I would like to have a more robust way of controling the 
>loading order.
>
>Do you have a better solution?
>
>Thanks in advance,
>
>Philippe.
>



More information about the AccessD mailing list