Roz Clarke
roz.clarke at donnslaw.co.uk
Fri Jul 4 07:57:27 CDT 2003
JC Try as I might (and it is Friday afternoon, to be fair!) I can't find the article on databaseadvisors.com. Can you give me a wee pointer?? Thanks Roz -----Original Message----- From: John Colby [mailto:jcolby at colbyconsulting.com] Sent: 01 July 2003 18:46 To: Access Developers discussion and problem solving Subject: RE: [AccessD] Calling control (WAS How do I determine which form called?) Roz, I designed a message class for just this kind of thing. The class accepts messages in a method, then raises a message event. I instantiate the class globally (shhhhhh) such that anyone can sink the classes events. Form1 dims an instance of the class, but instead of doing: set MyMsgInstance = new... it simply gets a copy of the global class instance: Set MyMsgInstance = gclsMsg (the global instance) Form1 opens the pop up form (or any other form really). It can either send it's name in the OpenArgs as it opens Form2 or... Form2 can instantiate an instance of the message class as well. It then listens for messages. Form1 sends a message to form2 passing it's name in From: and form2's name in the To: Either way, Form2 knows who opened it now. When it is done with it's task, it sends a message back To: form1 From: Form2. Form1 gets the message and handles the data. I wrote the message class up as an article and the article is out on the dba site, along with a demo of using it. John W. Colby www.colbyconsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Roz Clarke Sent: Tuesday, July 01, 2003 1:30 PM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Calling control (WAS How do I determine which form called?) You know, I think it does :-) The control name + parent form information should be enough to identify the calling control to the extent that each form can check to see whether it needs to respond to the event or not - by passing the control and parent information up to frmTextZoom and back again, I can pinpoint the calling control and grab the data. (Necessary because all open forms (barring menus) will have to contain the sink event and all will be responding in exactly the same way). It rests on the assumption that I only use each subform control name once throughout the database - if I instantiate a form twice, or if I've re-used a subform, I am stuffed because both copies of the form will think they own the calling control. A lot closer though. Roz -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030704/18a0fb3c/attachment-0001.html>