jwcolby
jwcolby at colbyconsulting.com
Tue Feb 2 22:54:48 CST 2010
As you probably know by now, subforms load before parent forms, and their current events fire before the parent's current event. It always puzzled me how they pull off this trick, but they do. Usually this is not a problem but it can be. For example, the main form has a "client" combo / field. The child form does not use or care about that. The grandchild form however needs that value to filter a combo to only display records from a table for that specific client. In this case, it doesn't appear to work correctly. The combo in the grandchild form is always a step behind the parent form, IOW if the parent displays client A, the combo in the grandchild displays whatever the parent had the PREVIOUS record. So the current event of the main form fires last after all of the child / grandchild forms load (and their load / current events fire). Logically, that current event of the main form needs to reach two levels down and tell that combo to requery itself. What a PITA. I actually built in to my framework collections of dependent child objects so that I could tell a form or a control on a form that "these objects are dependent on your data" and call those objects and requery them. Of course I have to write code in the load event of the form to set up the dependent object hierarchy. So how do YOU handle this kind of situation? Curious minds want to know. -- John W. Colby www.ColbyConsulting.com