none
Trigger button click event of Access VBA form from c# RRS feed

  • Question

  • Can anybody help me to get this functionality.

    I have no problem of accessing the functions from VBA which are public. Now I want to know that How can I click a button in MS-Access VBA from c#. Because the button_click method is private in VBA.


    Friday, January 8, 2016 7:23 AM

Answers

  • Have you tried changing the declaration of the button click event as Public?  (Disclaimer - I have not tried this myself)  I'm guessing that it *might* work if your click event code was written to be independent of other local procedures/controls etc.  However, if the code refers to local controls on your form, other private subs/functions/etc, you will probably need to rewrite the code more generically, as a public sub/function.

    EDIT:

    BTW - the method for referring to a control event from code outside of the form is to re-declare the control's event as PUBLIC and include the form's path when calling the event (untested in c#...you can try this in your automation code):

    Forms!FormName.ButtonName_Click()


    Miriam Bizup Access MVP



    Friday, January 8, 2016 11:14 AM