Determine control name for a macro defined for a click event

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Access 2000.
I have a form with two dozen command buttons that will all perform similar
routines. Now, I can have two dozen VBA click events--one for each
button--but I'd like to avoid that clutter. I could define a macro that calls
a VBA function, assign that macro to the button's click event, then copy that
button 23 times. Each copy would then call the same macro. So instead of 24
VBA click events, I'd have one macro. However, I can find no way of
determining, either in the macro or in the function that the macro calls,
which of the 24 buttons was clicked. Any ideas?
 
Screen.ActiveControl.Name should return the name of the control that has the
focus when the macro runs.
 
Back
Top