By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,374 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Reference Event on Other Form

P: n/a


I have two forms, Form1 and Form2.

Form1 has a command button, cmd1 with a click event: cmd1_Click()

I'd like to be able to also run this click event from a command button
on Form2.

How do I this?

I tried (in form2):

Form_Form1.cmd1_Click()

and several other possibilities, but none of them work.

Thanks for the help.

- Bruce

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Bruce B wrote:
I have two forms, Form1 and Form2.

Form1 has a command button, cmd1 with a click event: cmd1_Click()

I'd like to be able to also run this click event from a command button
on Form2.

How do I this?

I tried (in form2):

Form_Form1.cmd1_Click()

and several other possibilities, but none of them work.

Thanks for the help.

- Bruce

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


I use this code to make the Afterupdate event fire in another control;

Forms!frm_main.April_AfterUpdate

and the event is named as follows;

Sub April_AfterUpdate()
'my code
End sub

Just amend for a click event and it should work.

hth
Martin
Nov 12 '05 #2

P: n/a

The easiest way to do this is to change the declaration of the Click event
from Private to Public.
Terry

"HJ" <hj******@hotmail.com> wrote in message
news:3f*********************@dreader4.news.xs4all. nl...
Hmm, you better write a procedure in a module and have both the command
button and the second form call that procedure. What are you trying to
accomplish?

HJ

"Bruce B" <br***@mtiglobal.com> wrote in message
news:3f***********************@news.frii.net...


I have two forms, Form1 and Form2.

Form1 has a command button, cmd1 with a click event: cmd1_Click()

I'd like to be able to also run this click event from a command button
on Form2.

How do I this?

I tried (in form2):

Form_Form1.cmd1_Click()

and several other possibilities, but none of them work.

Thanks for the help.

- Bruce

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.