how to call current event procedure of from from subfrom

masoud_sedighy

Registered User.
Local time
Today, 14:56
Joined
Dec 10, 2011
Messages
132
i have a main form and it's name is:[frmTranstoCon-vp_New]

and this main form has a continuous subform and it's name is:[fsubTranstoConDoc-vp_New]

now i want after click one button from a subform i call the current event procedure of main form, i have done it in several ways but i got error:

"Application defined or object defined error"


what i have done for calling current event procedure of main from from it's subform is like below:

1- Forms![frmTranstoCon-vp_New].Form_Current

2- Me.Parent.Form_Current
 
The Current event is Private sub, mske it Public, by editing the declaration.
 
thank you very much, it works now
 
You are welcome.
 
Oops, I have done that a few times, but so far always from within the same form.

Eg I set a checkbox on load then call it's click event.

It's not considered good practice to call an object event directly. Also, it is unnecessary, all you do is put the code that currently resides in the on current event in its own function or sub procedure and call that.

This is a very good example of why this approach would be better. In this example you are protecting the private on current event. In other words, it is unnecessary to make the on current event public, all you do is make the new function or subroutine public.
 
Last edited by a moderator:

Users who are viewing this thread

Back
Top Bottom