Multicolum filter combobox

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
 
P

Piet Linden

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
 
B

bymarce

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top