A.D.Tejpal
adtp at touchtelindia.net
Wed May 12 12:33:57 CDT 2004
Ryan, If you do it when the form is in design view and then Save, the effect will be permanent. The following sample code, executed from a module external to the form in question, will do the needful (CmdTest is the name of a command button on form named F_Test)- DoCmd.OpenForm "F_Test", acDesign Forms("F_Test")("CmdTest").OnClick = _ "[Event Procedure]" DoCmd.Close acForm, "F_Test", acSaveYes Could you kindly try it out and let me know ? Regards, A.D.Tejpal -------------- ----- Original Message ----- From: rsmethurst at UK.EY.COM To: Access Developers discussion and problem solving Sent: Wednesday, May 12, 2004 17:29 Subject: [AccessD] Saving onClick event procedure Hi All, I'm trying to programatically 'hook' an event from a control (on a form) up to an event procedure. I.e. frm.Form.Controls("optValue").OnClick = "[Event Procedure]" Which works fine, until the form is taken out of 'form view'. I.e. if I change to design view for the form, or close the form. Once that happens the on click property is returned to being empty (or unhooked). I've tried saving the form but this seems to make no difference... Can anyone help? TIA Ryan