Reputation: 9194
I have a number of forms that have the same controls, Year for example, that are used for different reports. There are dozens of forms with the control named Year with GotFocus / OnFocus event triggers. I am trying to avoid writing a bunch of class modules with pretty much the same code which would require something like:
Private Sub Year_OnFocus()
I would like to write a function in a module so I can refer to Year relative to the form it is one with:
Forms!Home!NavigationSubForm.Form.Year.OnGotFocus
This does not seem to work, let alone behave the same way as the Private Sub Year_GotFocus
. So was wondering if anyone has any constructive suggestions.
Upvotes: 1
Views: 164
Reputation: 56026
You are looking for WithEvents
. Documentation is poor, but a nice intro is here. Browse to the header A Little History:
Upvotes: 2