Calling an event procedure from a subform

  • Thread starter Thread starter RBM
  • Start date Start date
R

RBM

I have an Update button on a form that, on Click,
rechecks/updates certain data (there is a sub
called "UpdateButton_Click()") I would like to be able to
call that event procedure from a SubForm. For example,
when I change a customer name in the subform, I would like
to have the CustomerName field On Change property call the
UpdateButton_Click.

When I enter a line in the CustomerName, OnChange event
procedure that says: "Call UpdateButton_Click", I get an
error message saying "Sub or Function not defined".

Any ideas??? Thanks in advance.
 
RBM said:
I have an Update button on a form that, on Click,
rechecks/updates certain data (there is a sub
called "UpdateButton_Click()") I would like to be able to
call that event procedure from a SubForm. For example,
when I change a customer name in the subform, I would like
to have the CustomerName field On Change property call the
UpdateButton_Click.

When I enter a line in the CustomerName, OnChange event
procedure that says: "Call UpdateButton_Click", I get an
error message saying "Sub or Function not defined".

Any ideas??? Thanks in advance.

You must declare the UpdateButton_Click() as a Public procedure in the
parent form; i.e.,

Public Sub UpdateButton_Click()

and then you must use a reference to the subform's Parent property to
call it by:

Call Me.Parent.UpdateButton_Click
 
Dirk, Thanks! I had tried the "public" statement but
never got it in the right combination with the Me.Parent
part. Works great
 
Back
Top