On 2 Jun 2005 19:38:29 -0700,
cw****@psu.edu wrote:
I was trying something like this:
Me.Invoice_Subform.Form.btnAddRecord_Click
But, alas, it is not working.
First point - by default, event procedures are defined as Private by default,
so they can't be invoked from other modules. You -could- fix that by making
the event procedure public, but ...
Generally, you want code to be as self-descriptive as possible. The main
form's code is not clicking the button on the subform, is it? No, it's
requesting an action that happens to be the same action the button performs.
In that case, it makes more sense to make a new public function with a name
descriptive of what it actually does, and call that both from the click
handler of the button on the subform and from the code on the main form.
If you are making your code self-documenting, most event handlers never end up
doing much directly (regardless of whether something else needs to perform the
same action - yet), they instead call one or a small number of other,
descriptively named procedures that actually do the work.