In my attached database I am trying to filter the form frmUKAccountsOpen, which is filtered through query QryUKAccountsOpen
The issue Im having is that no matter what method I use, I have tried a few, my textbox, txtNameFilter keeps asking for a parameter value.
The code I am using is borrowed from an online source and is:
Private Sub txtNameFilter_KeyUp(KeyCode As Integer, Shift As Integer)
On Error GoTo errHandler
Dim filterText As String
'Apply or update filter based on user input.
If Len(txtNameFilter.Text) > 0 Then
filterText = txtNameFilter.Text
Me.Form.Filter = "[QryUKAccountsOpen]![CompanyName] LIKE '*" & filterText & "*'"
Me.FilterOn = True
'Retain filter text in search box after refresh.
txtNameFilter.Text = filterText
txtNameFilter.SelStart = Len(txtNameFilter.Text)
Else
' Remove filter.
Me.Filter = ""
Me.FilterOn = False
txtNameFilter.SetFocus
End If
Exit Sub
errHandler:
MsgBox Err.Number & " - " & Err.Description, vbOKOnly, "Error ..."
End Sub
I tried Me.Form.Filter = "[frmUKAccountsOpen]![CompanyName] LIKE '*" & filterText & "*'" but had the same issue.
This is just a part of a bigger database, but just need to make this fiddly thing work but cant get my head around it.
Ideas on just this issue please?
Regards