Calling an event procedure from a subform

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.
 
D

Dirk Goldgar

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
 
R

RBM

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top