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

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.
 
R

RBB

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
 
W

Wayne Morgan

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
 
R

rbb

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top