Hi everyone, a real access novice here with a problem regarding this keyword search. Basically I have listbox with a query between two tables as a control source. The idea is for the user to type the listbox would filter itself and get shorter based on what the user types and as they type and also textboxes underneath the listbox would autopopulate. Here is my VBA for the search text box. Everytime i type even a single letter into the search i get this error that says "invalid use of Null" if someone can please guide, that would be very appreciated. Thank you.:banghead:
Private Sub txtKeywords_Change()
Dim vlocateString As String
vlocateString = txtKeywords.Text
Me.SearchResults.Requery
If Len(Me.txtKeywords) <> 0 And InStr(Len(txtKeywords), txtKeywords, " ", vbTextCompare) Then
Exit Sub
End If
Me.SearchResults = Me.SearchResults.ItemData(1)
Me.SearchResults.SetFocus
DoCmd.Requery
Me.txtKeywords.SetFocus
If Not IsNull(Len(Me.txtKeywords)) Then
Me.txtKeywords.SelStart = Len(Me.txtKeywords)
End If
End Sub
Private Sub txtKeywords_Change()
Dim vlocateString As String
vlocateString = txtKeywords.Text
Me.SearchResults.Requery
If Len(Me.txtKeywords) <> 0 And InStr(Len(txtKeywords), txtKeywords, " ", vbTextCompare) Then
Exit Sub
End If
Me.SearchResults = Me.SearchResults.ItemData(1)
Me.SearchResults.SetFocus
DoCmd.Requery
Me.txtKeywords.SetFocus
If Not IsNull(Len(Me.txtKeywords)) Then
Me.txtKeywords.SelStart = Len(Me.txtKeywords)
End If
End Sub