Access 2000: I want Subform1 to load before Subform2

C

Cabby

I have created two forms that are supposed to work similar. In fact, the
appearance is supposed to be the only thing changed.
Both forms are similar to "Customer Orders" from NorthWind.

When I open FormA, the customer orders are displayed properly in Subform1
and the details of first order are displayed
in Subform2. I have noted that Subform1 loads first, Subform2 is second and
MainForm is third.

When I open FormB, Subform1 is OK but Subform2 is displaying a "new
orderdetails record" entry for customer order 1.
I noticed that Subform2 loads first, Subform1 is second.

The Current Event of Subform1 is supposed to requery Subform2.

BTW, both forms work correctly after I select customer order 2 and go back
to order 1.

TIA

Cabby
 
M

Marshall Barton

Cabby said:
I have created two forms that are supposed to work similar. In fact, the
appearance is supposed to be the only thing changed.
Both forms are similar to "Customer Orders" from NorthWind.

When I open FormA, the customer orders are displayed properly in Subform1
and the details of first order are displayed
in Subform2. I have noted that Subform1 loads first, Subform2 is second and
MainForm is third.

When I open FormB, Subform1 is OK but Subform2 is displaying a "new
orderdetails record" entry for customer order 1.
I noticed that Subform2 loads first, Subform1 is second.

The Current Event of Subform1 is supposed to requery Subform2.

BTW, both forms work correctly after I select customer order 2 and go back
to order 1.


It seems like the subforms are loaded in the order that you
added them to the main form. So you can change it only by
Cutting the one you want to load last and then Pasting it
back on the form.

That is too mystical for me and I recommend that you use the
Link Master/Child properties to synchronize the two subforms
instead of using a criteria in the second subform's record
source query. This is easy to do by adding a hidden text
box (name it txtLink) to the main form's header section.
Then subform1's Current event can set the text box to its
primary key field using:
Parent.txtLimk = Me.[pk field name]

With that taken care of, set subform2's Link Master property
to txtLink and Link Child property to the pk field name.

The rest is automatic, no criteria in the query, no requery.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top