I am trying to get a label control on a form to display a control's name (i.e., field name from a table) when the control is selected. I know I can program each control's GotFocus event to do this but I am hoping there is some process using something like one of the Form's events to do this. However, it doesn't seem like selecting a control on the form triggers any of the Form's events.
In more detail, currently the GotFocus event of a combobox on the Form runs VBA code that uses the Screen.Previous Control.Name to return the "selected field" name (i.e., the field that had the focus prior to selecting the combobox) and then runs code to populate the combobox's RowSource with a list of the unique values of the field from the underlying table. Then when a value is selected from the dropdown list, it filters the underlying table based on the combobox value. This all work great in my programming.
However, I would like some method of having a label next to the combobox display the selected field's name so they know what field they will be filtering by when they use the combobox before they even give the combobox the focus. Hopefully this makes sense.
In more detail, currently the GotFocus event of a combobox on the Form runs VBA code that uses the Screen.Previous Control.Name to return the "selected field" name (i.e., the field that had the focus prior to selecting the combobox) and then runs code to populate the combobox's RowSource with a list of the unique values of the field from the underlying table. Then when a value is selected from the dropdown list, it filters the underlying table based on the combobox value. This all work great in my programming.
However, I would like some method of having a label next to the combobox display the selected field's name so they know what field they will be filtering by when they use the combobox before they even give the combobox the focus. Hopefully this makes sense.
Comment