I have a form with many buttons. Most of these buttons have a .tag field where I identify their function (numeric field)
Every button, on click, should execute same code
You can call a function from the form module directly from the button click events, and use Screen.ActiveControl
to determine the calling button.
Private Function GenericButton()
Debug.Print "Called from " & Screen.ActiveControl.Name
Call WriteTimbraIN(CInt(Screen.ActiveControl.Tag))
DoCmd.Close
End Function
And then assign =GenericButton()
as OnClick event.
You can do this in one go by multi-selecting all buttons and then setting the property.
Yes, use WithEvents. An example can be found here:
Create Windows Phone Colour Palette and Selector using WithEvents