John Bodin
jbodin at sbor.com
Wed Nov 12 14:33:12 CST 2014
Hi Susan, I don't understand fully what you are trying to do as I haven't been following your project too closely, but you can call event procedures like you want, but if the event is in a different form, I believe the event has to be declared public in the receiving form (second form in your example.) Alternatively, you could use the OpenArgs event of the second form and pass a variable to it from the first form's call. Then, like you suggest, in the open event of the second form, test if OpenArgs = "X", call your Click event then or enable or disable some controls. E.G. If OpenArgs = "X" then Me.ctrl1.Enabled = False Or Call Ctrlx_click() End if HTH John -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Susan Harkins Sent: Wednesday, November 12, 2014 3:13 PM To: Access Developers discussion and problem solving Subject: [AccessD] Forcing an event I have a command button on one form that opens a second form. On the second form, I use a click event to enable and disable other controls based on the value in the clicked event. I'm also passing a value to the second form and using that to filter the form's Recordset -- so the control that determines the disabling and enabling has a selected value. I need to force that click to enable and disable the other controls. All this happens for me automatically when opening the form for new records, because the user must select a value to trigger the event that disables/enables the other controls. When opening from the other form, however, the value is already set to the appropriate animal's record. I tried the Call statement to force the click event, but it doesn't work. I think the problem is that the code calling is on the first form. When I explicitly name the form in the Call statement, I get an error -- Call Forms![Enter Disposition Details]!lstDispositionDetailsID_Click() VBA just won't take that syntax. I looked it up and Call wants only the procedure name. I suppose I could write some kind of evaluation in the form's open event that tries to determine how the form is being opened, but that sounds gruesome. I can train the user to just click the control of course, but that's error prone because users forget. Any suggestions? Susan H. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com