I have a button that has the ability to change two text boxes, depending on which one has focus.
Does anyone know how to verify if a conrol hasfocus?
The only way I know how to do this is to use a global variable and in the control's GotFocus/LostFocus event I should update the global variable with the control name or a null value.
But I am interested in seeing if there is a way to determine if a specific field has focus (if you know the name of the control), or if there is a way to get the name of whatever currently has focus (if you don't know the name of the control).
Does anyone know how to verify if a conrol hasfocus?
Code:
If Me.ControlName1.hasFocus Then
Me.ControlName1 = GetValue()
Else If Me.ControlName2.hasFocus Then
Me.ControlName2 = GetValue()
Else
Exit Sub
End If
The only way I know how to do this is to use a global variable and in the control's GotFocus/LostFocus event I should update the global variable with the control name or a null value.
But I am interested in seeing if there is a way to determine if a specific field has focus (if you know the name of the control), or if there is a way to get the name of whatever currently has focus (if you don't know the name of the control).