I wrote a form that executes requests asynchronously when text is typed into a text field, but I usually seem to cause the following error: "You cannot reference a property or method for control if the control has no focus."
Directly relevant code:
Dim UpdateRequested As Boolean
Dim qryText As String
.
.
.
Private Sub txtBox_Change()
qryText = txtBox.Text
UpdateRequested = true
End Sub
Some place in ellipses is code that handles dynamically loading a set of ADODB records, populating a local table, and updating a subform. However, even when I turned off this code, the problem persists: sometimes I get an error. Sometimes I don’t do it.
. , , , , , " " .
Update
, :
Private Sub txtBox_GotFocus()
MsgBox "Got focus"
End Sub
Private Sub txtBox_LostFocus()
MsgBox "Lost focus"
End Sub
. . "Got focus". , , . , ( ) " " " ", . , "Screen.ActiveControl.Name" Text.