Determine control name for a macro defined for a click event

O

Olive Music

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?
 
K

Ken Snell \(MVP\)

Screen.ActiveControl.Name should return the name of the control that has the
focus when the macro runs.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top