Run Button Click-Event

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good afternoon,

How can execute the onclick_event of another form's command button? Nothing
I tried as of yet has worked. Basically I want to simulate a user clicking
the button without re-writing the entire code.

Thank you,

Daniel
 
Two ways to do this. 1) Put the code into its own sub routine and call it
from both places. 2) Make the onclick routine public (default is private),
then call it with: Forms("FormNm").CmdNm_Click
 
Good afternoon,

How can execute the onclick_event of another form's command button? Nothing
I tried as of yet has worked. Basically I want to simulate a user clicking
the button without re-writing the entire code.

Thank you,

Daniel

First change the other form's Command Button click event from:
Private Sub CommandName_Click()
to
Public Sub CommandName_Click()

Then code this forms event:

Call Forms("OtherFormName").CommandName_Click

*** BOTH forms must be open at the time. ***
 

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

Back
Top