Gasman
Enthusiastic Amateur
- Local time
- Today, 04:45
- Joined
- Sep 21, 2011
- Messages
- 14,299
Hi all,
This is for my education...again.
This link works perfectly in Northwind when implemented as described.
https://www.microsoft.com/en-us/mic...5/03/using-a-combo-box-to-search-as-you-type/
However when no record can be found the error 2185 (as shown in pic) happens, saying control must have focus, but the previous command is SetFocus.?
As you can see, I even tried GotoControl as well?
This is for my education...again.
This link works perfectly in Northwind when implemented as described.
https://www.microsoft.com/en-us/mic...5/03/using-a-combo-box-to-search-as-you-type/
However when no record can be found the error 2185 (as shown in pic) happens, saying control must have focus, but the previous command is SetFocus.?
As you can see, I even tried GotoControl as well?
Code:
Private Sub cboFilter_Change()
If Nz(Me.cboFilter.Text) = "" Then
Me.Form.Filter = ""
Me.FilterOn = False
ElseIf Me.cboFilter.ListIndex <> -1 Then
Me.Form.Filter = "[Name] = '" & _
Replace(Me.cboFilter.Text, "'", "''") & "'"
Me.FilterOn = True
Else
Me.Form.Filter = "[Name] Like '*" & _
Replace(Me.cboFilter.Text, "'", "''") & "*'"
Me.FilterOn = True
End If
'Me.cboFilter.SetFocus
DoCmd.GoToControl ("cboFilter")
Me.cboFilter.SelStart = Len(Me.cboFilter.Text)
End Sub