Apply filter command button code

G

Guest

The following code:

Private Sub Command160_Click()

If Not IsNull(Me.Combo59) Then
Me.FilterOn = True
Me.Filter = "[Company] = '" & Me.Combo59 & "'"
Else
Me.FilterOn = False
End If

End Sub


Is correctly applying a filter, but subsequent clicks only repeat the last
filter I applied. After I remove filter (using the menu bar button), and
move to another record, with a different Company displayed in the combobox,
and click my filter button, I get the same set of records as the last filter,
based on the Company value that was present in the previous filter. Closing
the form and reopening it allows me to filter correctly on a different
Company.

How do I completely clear the filter, and on what event?
 
G

Guest

Nm, I just added a second button to the form:

Private Sub Command161_Click()

Me.Filter = ""

End Sub


Works as intended, if inelegant.
 

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