Click for form button from Macro

  • Thread starter Thread starter John D via AccessMonster.com
  • Start date Start date
J

John D via AccessMonster.com

Sorry for simple question. I want click form button from Macro. Any Help
please.
Regards
 
does the button you want to click have a macro or VBA procedure attached to
it? instead of trying to "physically click" the button, you can just use a
RunMacro or RunCode action in your macro, to get the same result that you
would get from clicking the button.

hth
 
Thank you for response, I want to call button event (i.e. command38()) from a
macro. I tried to define RunCode in macro but it accepts only Function where
I have only button procedure.
Regards
 
okay. suggest you move the button's code into a public function in a
standard module, so it can be called from the button's event procedure, and
also from the macro, as

Private Sub command 38_Click()

isButtonCode

End Sub

Public Function isButtonCode()

' put here whatever code was running from the button

End Function

(depending on what the code is doing, it may have to be rewritten to run in
a standard module rather than the form's module, but try it first and see
how it goes.)

now when you click the button manually in the form, it'll call the function
that runs the code. and you can use the RunCode macro action to run the
function directly, using the Action Argument

Function Name: isButtonCode()

hth
 
Back
Top