Jim Dettman
jimdettman at verizon.net
Tue Jun 21 12:53:34 CDT 2011
John, <<2) I can if I wish create 1 to N (hundreds if I wish) different instances of clsMsg and each "functional set" can grab a pointer to the clsMsg instance that it needs to watch messages on.>> Then why did your intial post contain this sample code: private sub mcMsg_Message(varFrom as variant, varTo as variant, varSubject as variant, varMsg as variant) if VarFrom = "MyName" then if VarTo = "WhoThisIsGoingTo" then if VarSubject = "MySubject" then 'Requery the combo MyCombo.requery endif endif endif end sub It implies that it may receive events that don't pertain to it. Other wise, there would be no need for the first two If checks. And if you implemented a BO class as Drew outlined, there'd be no need for the third either. <<3) Most forms just "sit there" anyway. The user is looking at the screen, yaking on the phone, smoking a cigarette and oh yea, entering stuff. Processing a message is going to take about... under a millisecond. Probably a few hundred microseconds in fact. So even if I have a dozen forms open at once, and all of them use the message channel, how much machine time is actually used to process the message in all the forms?>> Sorry, but to me, it's that type of thinking that has lead to bloated/slow software. Jim. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, June 21, 2011 12:55 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Refreshing open forms when something changes > I think JC was talking about a messaging class for an example of using events, not as his end all be all of using events. Precisely. In fact several things come into play here. 1) Only forms that grab a pointer to clsMsg and sink the events actually get the message (have to process it). 2) I can if I wish create 1 to N (hundreds if I wish) different instances of clsMsg and each "functional set" can grab a pointer to the clsMsg instance that it needs to watch messages on. 3) Most forms just "sit there" anyway. The user is looking at the screen, yaking on the phone, smoking a cigarette and oh yea, entering stuff. Processing a message is going to take about... under a millisecond. Probably a few hundred microseconds in fact. So even if I have a dozen forms open at once, and all of them use the message channel, how much machine time is actually used to process the message in all the forms? > I think JC was talking about a messaging class for an example of using events, not as his end all be all of using events. In my framework I have dozens of classes and they sink literally hundreds of events. The message class is nothing more than an example of using events to solve a specific common problem. We have all run into this "something happens over here and the combos over there are not requeried". I actually fixed this specific problem in this specific database using my clsMsg. BTW I have been using this for about 10 years now. From my framework, circa 12/2001: '-------------------------------------------------------------------------- '.Written By : John W. Colby '.Date Created : 12/06/2001 '.Rev. History : '.Comments : '.------------------------------------------------------------------------- '. ' ADDITIONAL NOTES: ' 'The message class implements a Withevent / RaiseEvent communications method 'that can now be generically implemented using this class as the comm object. John W. Colby www.ColbyConsulting.com On 6/21/2011 12:21 PM, Drew Wutka wrote: > Ummmmmm.... but that is only if you are creating an extremely broad and > generic event process. > > In your example, of a customer being added, if I was developing a system > I would have a 'customers' class, which had a 'New' (or changed) > Customer event. So only forms/windows/classes that interacted with the > Customers class would have that event sunk, so that only those > forms/windows/classes would do anything when that event was raised. > > I think JC was talking about a messaging class for an example of using > events, not as his end all be all of using events. > > Drew -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com