Run Button Click-Event

D

Daniel

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
 
G

guido via AccessMonster.com

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
 
F

fredg

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