Steve R.
Retired
- Local time
- Yesterday, 20:54
- Joined
- Jul 5, 2006
- Messages
- 5,686
A while back I figured out how to get the name of the active control. Since I don't do Access on a continuous basis, I forgot about it. Of course the situation arose where I needed it again and it took a while for me to find it.
A search of this forum didn't uncover this approach, so I am posting the code for reference. This code highlights the label of the active option button to make it obvious to the user where the user is on the form. A similar block of code resets the label when the user moves onto the next control.
Thanks again to Gemma-the-Husky and Rural Guy for helping in the development of the code for highlighting the active control.
A search of this forum didn't uncover this approach, so I am posting the code for reference. This code highlights the label of the active option button to make it obvious to the user where the user is on the form. A similar block of code resets the label when the user moves onto the next control.
Code:
Public Sub Enter_Option()
OptionNameStr = [B]Me.ActiveControl.Properties("name")[/B]
For Each CTRL In Me.Controls
If CTRL.ControlType = acLabel Then
If CTRL.Parent.Name = OptionNameStr Then
LabelNameStr = CTRL.Properties("name")
CTRL.BorderStyle = 1: CTRL.BorderColor = BORDERCLR: CTRL.BorderWidth = 3
End If
End If
Next CTRL
Thanks again to Gemma-the-Husky and Rural Guy for helping in the development of the code for highlighting the active control.