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
> 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
DMH - 12 May 2008 13:38 GMT
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
> 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
[quoted text clipped - 10 lines]
> >
> > Thanks
fieldname_afterupdate
filter = "FIELDNAME = """ & FIELDNAME & """" for strings
filter = "FIELDNAME = " & FIELDNAME for numbers
> 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
Jason - 09 May 2008 22:02 GMT
forgot filteron = true
to turn filtering off - filteron = false
> fieldname_afterupdate
> filter = "FIELDNAME = """ & FIELDNAME & """" for strings
[quoted text clipped - 6 lines]
> >
> > Thanks