Calling a command button

  • Thread starter Thread starter perico
  • Start date Start date
P

perico

If I have a command button on form "A", is it possible to
execute that command in code from form "B"? Is so, how?
 
The simplest is to copy the code in a public procedure and call the
procedure from form A and B as necessary. If you insist on using the
event code for the button, I'd like to hear why before going into how to
do it.

Cheers,
Pavel
 
Remove the "Private" keyword from the declaration of the procecure, e.g.:
Private Sub MyButton_Click()

You can now call it like this:
Form_A.MyButton_Click

Note that "Form_A" is the name of the module for a form named "A".
 
Back
Top