Run Code on one subform from another subform

G

Guest

I have a parent form which has 2 subforms. I need to click a button (or run
the code associated with the button) on subform1 within code from subform2.
Again I have tried many approaches.

Code which is running in subform2
Example1: forms!Parentform!Subform1!cmdButton.click
Example2: forms!Parentform!Subform1.cmdButton_click
I have used this same syntax to populate fields and it works. In short there
is a bunch of code that needs to run when the subform1 is changed, updates
several tables etc.
 
M

Marshall Barton

Tracey said:
I have a parent form which has 2 subforms. I need to click a button (or run
the code associated with the button) on subform1 within code from subform2.
Again I have tried many approaches.

Code which is running in subform2
Example1: forms!Parentform!Subform1!cmdButton.click
Example2: forms!Parentform!Subform1.cmdButton_click
I have used this same syntax to populate fields and it works. In short there
is a bunch of code that needs to run when the subform1 is changed, updates
several tables etc.


The code in subform2 could be:

Parent.subform1.FORM.cmdButton_click

Don't forget that the cmdButton_click procedure must be
Public.
 
G

Guest

Perfect!! Thanks so much!

Marshall Barton said:
The code in subform2 could be:

Parent.subform1.FORM.cmdButton_click

Don't forget that the cmdButton_click procedure must be
Public.
 

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