Filter records based on combo box

  • Thread starter Thread starter Dale Fye
  • Start date Start date
D

Dale Fye

I've got a form that I want to filter. I have a second form that
opens up when the user clicks on a command button, where the user has
a number of filtering options based on several combo boxes. This
works fine for those fields where the field I want to filter on is in
the basic rowsource of the form.

However, several of the combo boxes are used to select an item from a
linking table (one to many relationship). For these combo boxes, I
modify the filter string by adding something that looks similiar to
the following, where I get the values inside the () by using a
concatenate function. If only one of these combo boxes is selected
the filter string looks like:

Forms!frm_someform.Filterstring = "Obsn_ID IN(1, 2, 3, 4)"
Forms!frm_someform.filteron = true

However, the filter property of my form does not appear to work using
this technique. Anyone have any ideas why not, and how I can get
around this?
 
It appears that it won't work without the brackets around the field name, even though you
don't have spaces in the name. Also, it may just be a typo in the message, but you need a
space before the ( and FilterString isn't a form property, it should just be Filter.

Forms!frm_someform.Filter = "[Obsn_ID] IN (1, 2, 3, 4)"
 
Back
Top