Show only Filtered Records

  • Thread starter Thread starter DMH
  • Start date Start date
D

DMH

Hello,

I have a form that displays records based on the value of a combo box. How
can I display only the returned records?

Thanks
 
If you have your combo set up correctly it show only the desired or filtered
records. When you insert a combo (use the wizard) and allow the wizard to
select the field you want to filter on. Then in the properties of the combo
(not the label) go to events. In the afterupdate event start the code builder
and type:
Me.filter = "[yourfieldname] = """ & Me.combo# & """"
Me.filteron = True
 
fieldname_afterupdate
filter = "FIELDNAME = """ & FIELDNAME & """" for strings
filter = "FIELDNAME = " & FIELDNAME for numbers
 
Thank you both very much for your replies. The code you gave me works with
most of my combo boxes but this particular one uses a lookup field to find
the records. Below is the existing code in the "after update" event. When I
add the code you gave me it gives me an error. Can either of you shed any
light on this for me?

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[OriginatorName] = " & Str(Nz(Me![Combo358], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark


Golfinray said:
If you have your combo set up correctly it show only the desired or filtered
records. When you insert a combo (use the wizard) and allow the wizard to
select the field you want to filter on. Then in the properties of the combo
(not the label) go to events. In the afterupdate event start the code builder
and type:
Me.filter = "[yourfieldname] = """ & Me.combo# & """"
Me.filteron = True

DMH said:
Hello,

I have a form that displays records based on the value of a combo box. How
can I display only the returned records?

Thanks
 
Back
Top