Hi guys,
I've pulled this code from Microsoft:
Code:
Private Sub cboFilter_Change()
‘ If the combo box is cleared, clear the form filter.
If Nz(Me.cboFilter.Text) = “” Then
Me.Form.Filter = “”
Me.FilterOn = False
‘ If a combo box item is selected, filter for an exact match.
‘ Use the ListIndex property to check if the value is an item in the list.
ElseIf Me.cboFilter.ListIndex <> -1 Then
Me.Form.Filter = “[Company] = ‘” & _
Replace(Me.cboFilter.Text, “‘”, “””) & “‘”
Me.FilterOn = True
‘ If a partial value is typed, filter for a partial company name match.
Else
Me.Form.Filter = “[Company] Like ‘*” & _
Replace(Me.cboFilter.Text, “‘”, “””) & “*'”
Me.FilterOn = True
End If
‘ Move the cursor to the end of the combo box.
Me.cboFilter.SetFocus
Me.cboFilter.SelStart = Len(Me.cboFilter.Text)
End Sub
https://blogs.office.com/2012/05/03/using-a-combo-box-to-search-as-you-type/
But when I paste it into access, it gives me a load of errors... I have a feeling its because of the " and ' symbols, but I don't know how to change them so the code works. Any advice?