Why doesn't .SetFocus get the message?
Can anybody tell me why .SetFocus does not work in this code in a continuous form?
When the filter is applied (if FilterOn was False) then the focus stays on the current control, regardless of my 'ConnectIdentify.SetFocus' code.
But when the filter is removed (if FilterOn was True), then the focus goes to the next control even if I put in the 'ConnectIdentify.SetFocus' code.
When I put the SetFocus in a DIFFERENT control, it DOES follow and gives focus for the required control.
???
Can anybody tell me why .SetFocus does not work in this code in a continuous form?
Code:
Private Sub ConnectIdentify_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Dim strFilter$
strFilter = Screen.ActiveControl.Name & "='" & Screen.ActiveControl.Value & "'"
If Me.FilterOn = False Then
Me.Filter = strFilter
Me.FilterOn = True
Else: Me.FilterOn = False
End If
End If
ConnectIdentify.SetFocus
End Sub
When the filter is applied (if FilterOn was False) then the focus stays on the current control, regardless of my 'ConnectIdentify.SetFocus' code.
But when the filter is removed (if FilterOn was True), then the focus goes to the next control even if I put in the 'ConnectIdentify.SetFocus' code.
When I put the SetFocus in a DIFFERENT control, it DOES follow and gives focus for the required control.
Code:
Private Sub ConnectType_LostFocus()
ConnectIdentify.SetFocus
End Sub
???
Last edited: