How do you activate a "COMMAND Button" with a macro?

  • Thread starter Thread starter RBB
  • Start date Start date
R

RBB

How can you activate a command button with a macro? I have
a "COMMAND BUTTON" called refresh, on a subform that works
very well. I would like to activate this "COMMAND BUTTON"
from the main form via a macro or very simple code.
 
Wayne, By activate I mean run code behind button. What I
want to do in a macro or VB code is just like I clicked on
the command button. Thank you for your help. RBB
-----Original Message-----
By "activate" do you mean run the code behind the button
or change the Enabled status of
 
Ok, I tried it from the main form, it should work from other locations as well.

I had to change Private to Public in the name of the button's click event, then call it.
Here is the code I used from the main form:

Me.sfmNameOfSubformControl.Form.NameOfButton_Click
 
Thanks for your help.
-----Original Message-----
Ok, I tried it from the main form, it should work from other locations as well.

I had to change Private to Public in the name of the
button's click event, then call it.
 
Back
Top