• need help specifying macro condition (97)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » need help specifying macro condition (97)

    Author
    Topic
    #358888

    rather than write 2 macros for 2 separate buttons I

    Viewing 0 reply threads
    Author
    Replies
    • #536550

      It isn’t clear what you’re trying to do. Were you trying to pass an argument to a macro? Did you want to do something different for each button? You’d be better off writing code for each button’s OnClick event.

      • #536553

        I basically wanted 1 macro associated with the onClick event of 2 buttons, the problem was the macro must recognize which button was clicked, I had trouble wrapping my head around how to specify a condition that would distinguish between either of buttons & which one was the active one (the one clicked) The condition I specified in my last post was an attempt at making a condition I thought would work but is not acceptable by access.

        • #536571

          You can’t really do that with a macro. It’s easy with code, but macros are highly inflexible. The best you could do would be use Screen.ActiveControl in a condition in the macro to specify the button. In other words, you condition might be Screen.ActiveControl = Forms!MyForm!Button1. If Button1 was the one that called the macro, that condition would evaluate true and the associated actions would execute.

    Viewing 0 reply threads
    Reply To: Reply #536553 in need help specifying macro condition (97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel