I have a split form with a Combo Box on top to filter Book Titles and Authors. It works great unless I type a something that yields no results. As soon as I type a string where there is no author or title matching, I get a run-time error '2105' You can't go to the specific record. The whole form except the Form header disappears. I can end or go to debug. Could someone help me prevent that. I've included the code below.
Thank you!
Code:
Option Compare Database
Option Explicit
Private blnSpace As Boolean
Private Sub cboFilter_Change()
If blnSpace = False Then
Me.Requery
Refresh
cboFilter.SetFocus
cboFilter.SelStart = Len(Me.cboFilter.Text)
End If
End Sub
Private Sub cboFilter_KeyPress(KeyAscii As Integer)
If KeyAscii = 32 Then
blnSpace = True
Else
blnSpace = False
End If
End Sub
Private Sub Form_Open(Cancel As Integer)
Me.cboFilter.SetFocus
End Sub