Multicolum filter combobox

  • Thread starter Thread starter bymarce
  • Start date Start date
B

bymarce

I have a filter form for searching a sample catalog based on Allen Browne's
code. The primary key for the sample catalog is compound and based on the
fields Prefix, Year, and ID. On the filter form I have two 3 column
comboboxes so the user can select a range of records. In a single column
combo box you can start typing the value and the drop down list will go to
that value. How can I do that with a multicolumn combobox? Currently it
will only go to values based on column 0. Thanks.
Marcie
 
I have a filter form for searching a sample catalog based on Allen Browne's
code.  The primary key for the sample catalog is compound and based on the
fields Prefix, Year, and ID.    On the filter form I have two 3 column
comboboxes so the user can select a range of records.  In a single column
combo box you can start typing the value and the drop down list will go to
that value.  How can I do that with a multicolumn combobox?  Currently it
will only go to values based on column 0.  Thanks.
    Marcie

So the combobox has all the possible values you can search for? You
would have to AND the different columns together in a string variable
and then apply the filter to your form.

field1 is a numeric field, field2 is a text field, field 3 is a date
field (so the different delimiters).

dim strFilter as string
strFilter = "[Field1]=" & me.cboSearch.Column(0) & " AND [Field2]='" &
me.cboSearch.Column(1) & "' AND [Field3]=#" & me.cboSearch.Column(2) &
"#"
Docmd.OpenForm "frmSomeForm",... strFilter
 
Thanks for the suggestion. Maybe I wasn't clear in my question but this
wasn't exactly what I was looking for. I ended up concencating the 3 columns
into one for the combobox and parsing the string later to apply the filter.
Thanks again for your time.
Marcie

Piet Linden said:
I have a filter form for searching a sample catalog based on Allen Browne's
code. The primary key for the sample catalog is compound and based on the
fields Prefix, Year, and ID. On the filter form I have two 3 column
comboboxes so the user can select a range of records. In a single column
combo box you can start typing the value and the drop down list will go to
that value. How can I do that with a multicolumn combobox? Currently it
will only go to values based on column 0. Thanks.
Marcie

So the combobox has all the possible values you can search for? You
would have to AND the different columns together in a string variable
and then apply the filter to your form.

field1 is a numeric field, field2 is a text field, field 3 is a date
field (so the different delimiters).

dim strFilter as string
strFilter = "[Field1]=" & me.cboSearch.Column(0) & " AND [Field2]='" &
me.cboSearch.Column(1) & "' AND [Field3]=#" & me.cboSearch.Column(2) &
"#"
Docmd.OpenForm "frmSomeForm",... strFilter
 
Back
Top