Run subroutine from Parent form

  • Thread starter Thread starter MichaelK
  • Start date Start date
M

MichaelK

How to refer to Sub on the parent form from the subform.
For example if dblClick in the field on the subform I want to
fire Click event for SomeButton button on the main form.

Regards,
Michael
 
MichaelK said:
How to refer to Sub on the parent form from the subform.
For example if dblClick in the field on the subform I want to
fire Click event for SomeButton button on the main form.


You can call the procedure as a method of the parent form:

Parent.SomeButton_Click
 
Thanks Marsh.
Sounds good, but not working for me.

Gives me Run-time error '2465':
Application-defined or object-defined error.

On the parent form I have control District.
So when click in the subform field I want to populate District with some
value,
and run it's AfterUpdate event sub.
I tried Parent.District_AfterUpdate as well as
Me.Parent.District_AfterUpdate
Same error.

Regards
Michael
 
Try replacing the "Private" keyword in front of the District_AfterUpdate
event with either Public or Friend.
 
Back
Top