Charlotte Foust
cfoust at infostatsystems.com
Thu Feb 20 19:46:00 CST 2003
You have to use the correct name for the event property, which is something like AfterUpdate, OnEnter, OnOpen, OnClose, etc.. The "click" event property name is OnClick, so it would be: frm!controlname.OnClick = "[Event Procedure]" If you have referenced a specific control object, the event names will show up in intellisense as properties of the control. Charlotte Foust -----Original Message----- From: Patricio Galleguillos [mailto:pgalleguillos at plus.cl] Sent: Thursday, February 20, 2003 5:18 PM To: accessd at databaseadvisors.com Subject: RE: [AccessD] Programmaticly fill control events Hi Marcel, Charlotte and Group Making some testing I generated a form that 'writes' code to another form and in this latter one I got: '------------------------------------------------- Option Compare Database Option Explicit Private Sub Texto5_Click() Debug.Print 44.56, 55.48 End Sub Private Sub txtForTesting_Click() Debug.Print 44.56, 55.48 End Sub '------------------------------------------------ So far, so good but when I open the form to see if the events fire, gunpowder seems to be wet... and the magic words [Event Procedure] did not appear as I thought. Also I think Marcel wants to specify the event with a string "click" for example and I don't see the way to associate with your code frm!controlname.click = "[Event Procedure]". With this 'detail', Marcel's problem would be practically solved, also the IDE ask's if I want to save which I obviously want. Case this cannot be avoid I think 200 clicks would be a bargain for so many 'coded events' Muchos Saludos Patricio Galleguillos -----Mensaje original----- De: accessd-admin at databaseadvisors.com [mailto:accessd-admin at databaseadvisors.com] En nombre de Charlotte Foust Enviado el: jueves, 20 de febrero de 2003 18:32 Para: accessd at databaseadvisors.com Asunto: RE: [AccessD] Programmaticly fill control events If you add a complete event procedure from code, then you also have to set the control object's event property to "[Event Procedure]" to make it catch, i.e., frm!controlname.AfterUpdate = "[Event Procedure]". Charlotte Foust -----Original Message----- From: Patricio Galleguillos [mailto:pgalleguillos at plus.cl] Sent: Thursday, February 20, 2003 11:24 AM To: accessd at databaseadvisors.com Subject: RE: [AccessD] Programmaticly fill control events Hi Marcel and Group Unless someone comes with a 'ready made' solution the steps for doing it can be: - Generate a list with the names of the forms and the names of the controls to be 'evented' - for each form get the code module (VBIDE) - for each control in the form append the appropriate event handler(s) in the code module. (easy at the end of the code module, checking that it is not already written. It may have code for doing something else) If you modify code programmatically inside a sub, it works but I'm not sure what happens if you add a complete sub. I have some code that uses VBIDE to show all names of functions and subs in a project (always forget where I put them...), if it can be useful mail me off line. (not very much comments and all of them in spanish) Maybe this is not very difficult for the gurus but I don't think it is an easy task for the rest of us. Saludos cordiales, Patricio Galleguillos B. pgalleguillos at plus.cl -----Mensaje original----- De: accessd-admin at databaseadvisors.com [mailto:accessd-admin at databaseadvisors.com] En nombre de Marcel Vreuls Enviado el: jueves, 20 de febrero de 2003 9:24 Para: accessd at databaseadvisors.com Asunto: [AccessD] Programmaticly fill control events Dear group, I have added some more color to my app. This means the control where the cursor is at that time is being highlighted. It works like a charm. I have found this solution in the archives of this list. But I have more than 200 forms en I gues more that 2500 controls. Is there a way through code to add an event to a control. So open the form en check all controls (that's what I know) but I don not know how to add an event and add some code through it. Anyone? Thanks Marcel _______________________________________________ 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