Dan Waters
dwaters at usinternet.com
Wed Sep 5 18:07:11 CDT 2007
Hi Shamil, What I've used in the past is a public Modular Boolean variable set in the main form's module. It's default value is false, of course. When the subform's load and open events are running before the main form is opened, the parent's Boolean variable is false, and the code is written to exit out of the subform load and/or open events. Only when that variable is explicitly set to True will the code not exit out. It can be set to true in either the parent form or the subform. What I'm actually managing is the subform's Current event, which is called by the Load event. I was just looking for an alternative. Thanks! Dan -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Wednesday, September 05, 2007 11:35 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] SubForm and form <<< I sure would like to manage a subform's load and open events. >>> Dan, That needs tricky programming if possible at all to manage these events using WithEvents because subform's Load and Open events fire *before* form's Load and Open events... IOW you'll need to use Me.Parent.SomeCallbackName callback procs from subform's module to "inform" parent form about subform's Load and Open events... -- Shamil -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Wednesday, September 05, 2007 8:31 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] SubForm and form John, Believe it or not, I initially figured that this could be done because I do try to learn from your postings! :-) I gave my suggestion simply because that's what I know how to do. Could you post a short example code of how you would set up the main form's monitoring of the subform's events? I sure would like to manage a subform's load and open events. Thanks! Dan -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Wednesday, September 05, 2007 7:43 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] SubForm and form You can also declare a pointer to the form WithEvents and then sink any of the form's events in the main form. Doing that allows you to see the subforms events from up in the main form and select them. When you select one of the events, VBA creates an event handler up in the main form. Click events and enter/exit events usually do not have a problem but you should remember that subforms load before the main form's class module so events like OnOpen and such cannot reference code up in the main form until the main form's class has finished loading. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Tuesday, September 04, 2007 10:07 PM To: 'Access Developers discussion and problem solving' Subject: [AccessD] SubForm and form Hi All: I just can not remember... too tied... too old. But how can a 'click' on a field within a subform be monitored and can subsequently produce a result on the main form? TIA Jim -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com