Apply filter to a form

W

Widemonk

OK, following on from my other post about form filters, this is my code
however ALL records are filtered.

Private Sub cmdMyFilter_Click()

'Save any edits first.
If Me.Dirty Then Me.Dirty = False

'Show all records if no search criteria specified
If IsNull(txtSearch) Then
Me.FilterOn = False
Exit Sub
End If

Me.Filter = "[txtName] Like '*" & txtSearch & "*'"
Me.FilterOn = True

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top