Zippersabrat
Blah Blah Blah :o)
- Local time
- Yesterday, 21:25
- Joined
- May 5, 2010
- Messages
- 31
Hello everyone! I have the below code on a subform. The search works fine IF the item is on the list. However, if the item is not on the list, it gives a 2185 error. WHY?! And how do I fix it? When I debug it highlights the Me.Searchbox.SelStart = Len(strSearch) line.
TIA
Code:
Private Sub SearchBn_Click()
Dim strSearch As String, _
strFilter As String
Me.Refresh
If IsNull(Me.SearchBox) Then
Me.SearchBox = "*"
End If
strSearch = Me.SearchBox.Value
strFilter = "Searchable like '*" & strSearch & "*'"
Me.Form.Filter = strFilter
Me.Form.FilterOn = True
If Not IsNull(Len(strSearch)) Then
Me.SearchBox.SetFocus
Me.SearchBox.SelStart = Len(strSearch)
If IsNull(Searchable) Then
MsgBox ("The search " & Me.SearchBox & " returned no results."), vbOKOnly + vbInformation, "Sorry"
Me.Form.FilterOn = False
End If
Me!SearchBox = Null
End If
End Sub