Searching on a combo box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to enable users to do a find on a combo box where the bound
column is a auto number field. Typing in the alpha expression in the find
window does not return the desired record.

Any ideas?
 
I would like to enable users to do a find on a combo box where the bound
column is a auto number field. Typing in the alpha expression in the find
window does not return the desired record.

Any ideas?

I'd suggest using a Query referencing a form.

Create an UNBOUND form named frmCrit (or your own choice of name of
course). Put a combo box on it, cboFindThis. Its bound column should
be the numeric ID; the first (or only) nonzero width column should be
the alpha expression.

Use

=[Forms]![frmCrit]![cboFindThis]

as a criterion in your query. Base a Form (for display) or Report (for
printing) on the query.

If you're using a Lookup field in a table datasheet, and searching in
this datasheet, you've encountered one of the many reasons that lots
of us dislike Lookup fields.


John W. Vinson[MVP]
 
Yes, this would be for instances when you want to find, lets say a company
name, on a company name cobo box, where the bound column for the company name
is an auto numeric field. So let's say the number for IBM is 34, the user
wouldn't know to search for 34, but rather would type in IBM, and would not
find IBM.
 
Ok, let me re-state it as I think I understand it.
You want to be able to type in a single comobox and pull a record based on
the autonumber primary key or the field that has the company name/title by
entering either a number or name.
If this is correct then you can follow what John said but add the criteria
in both columns but on different row of the query design grid. The different
row makes the criteria statement an OR function.
 
Thanks for the input. The thing I'm not understanding about John's
suggestion is that if I place a combo box in an unbound form, wont I have the
same problem searching on that combo box?
 
If your set Limit to list - No and Autoexpand - Yes then as you type is finds
the matching text. It will also allow you to enter a number which will not
be in the name field.
 
Back
Top