Filtering and Removing Filter based on a combo box

M

Michael

I have a combo box which I am trying to use as a records filter. It
works for finding records that match the combo box but my problem is
how to remove the filter and show all records once it has already been
filtered. Here is what I have so far:

Private Sub Form_AfterUpdate()
If Not IsNull(Me![FilterByTicketStatus]) Then
Me.Filter = "[TicketStatus]='" & Me![FilterByTicketStatus] &
"'"
Me.FilterOn = True
Else
Me.FilterOn = False
End If
End Sub

When the "FilterByTicketStatus" is cleared, it shows no records and
the filter button still shows active.

How do I fix this so it shows all the records and removes the filter
when the combo box is cleared?
 
A

Allen Browne

Use the after update event of the FilterByTicketStatus text box, not of the
form.

(Presumably this is an unbound text box.)
 
M

Michael

Now a followup question. I'm wondering if I can have more than one
combo box along the top of our forms which would allow the user to
filter the form based on a combination of different filters. Is it
possible and how would I code that?

Filter Combo Boxes desired:
Ticket Status
Ticket Sub-Status
Follow Up By
Ticket Number
Client
 
A

Allen Browne

Here's a free, downloadable example that you can pull apart and see how it's
done:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html

Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

"Michael" wrote in message

Now a followup question. I'm wondering if I can have more than one
combo box along the top of our forms which would allow the user to
filter the form based on a combination of different filters. Is it
possible and how would I code that?

Filter Combo Boxes desired:
Ticket Status
Ticket Sub-Status
Follow Up By
Ticket Number
Client
 

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