Filter using a combo box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an unbound combo box "cmbfilter" located in the form header that I
want to use to filter open and closed records. My row source type is
table/query and my row source is log_status_qry. I have a cmbo box
(cmbstatus) in the detail of the form that shows me the current "status" of
the record, "Open" or "Closed". I have read all that I can on the filter
command in the afterupdate procedure but I cannot get my filter to work. I
guess that I just don't understand where my problem is. Here is my code:

Private Sub cmbfilter_AfterUpdate()
Me.Filter = "status = " & Me.cmbfilter
Me.cmbstatus.Requery
Me.FilterOn = True
End Sub

TIA,
Bob W.
 
If you open your table in design view, what is the Data Type of the Status
field?

If it is Text (not Number or Yes/No), you need extra quotes:
Me.Filter = "status = """ & Me.cmbfilter & """"
 
Back
Top