Search / Ctrl + F in a combobox?

G

Guest

The combobox has as its rowsource a select statement that pulls "*", that is,
ID and Name (only two fields in the table). Column count = 2, bound column
is '1', the ID field.

Ctrl + F, a simple search, does not work if the user enters "friendly"
information, ie. a name or part of a name that would be found in column 2.
Works fine if the user enters the ID number. (I suspect this situation is
also behind the error I get when I try to filter the form on this
field/control--data type mismatch.)

So, what is the simplest way to enable a user to search for a meaningful
text string in this combobox, rather than the ID number? Is Ctrl + F never
going to work in this combobox?
 
F

fredg

The combobox has as its rowsource a select statement that pulls "*", that is,
ID and Name (only two fields in the table). Column count = 2, bound column
is '1', the ID field.

Ctrl + F, a simple search, does not work if the user enters "friendly"
information, ie. a name or part of a name that would be found in column 2.
Works fine if the user enters the ID number. (I suspect this situation is
also behind the error I get when I try to filter the form on this
field/control--data type mismatch.)

So, what is the simplest way to enable a user to search for a meaningful
text string in this combobox, rather than the ID number? Is Ctrl + F never
going to work in this combobox?

Hide the ID column by setting the Column widths property to:
0";1"

Set the Combo AutoExpand property to Yes.
Now the name field is the only field displayed, and the user can begin
to type the wanted name and the combo will automatically find names
that begin with those entered characters.
The Combo is still bound to the 1st column, so make sure the Control
Source of the Combo is the ID field in the table. If the Combo ID
field is an AutoNumber field then the bound field datatype must be
Number - Field Size Long Integer.

The ID will be stored in the table, but the Combo will display the
Name.
 
G

Guest

I'm a bit lost on your reply, Fred.

(Auto Expand is already set to 'Yes'.)

I've changed the Control Source to, using the builder: =[tblCompanies]![Name]

Now the company name that is stored in the table is not showing from record
to record, though if I click on the combo's dropdown I do get the full list
of companies...
 
G

Guest

Hmm, in rereading your reply I see that I did not state my problem clearly
enough. the combo is working as it's supposed to, it's showing the name, and
only the name, and it's auto-completing if a user is entering a name in a new
record. The problem is with searching the existing records...
 

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