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. ***
 
Back
Top