Setting Sort Order on a combo box in a form.

  • Thread starter Thread starter Antony Elson
  • Start date Start date
A

Antony Elson

Does anybody know how I can have a form, and in that form
I have a combo box looking at a table, this combo box
uses three columns First_Name, Sac, Service.

I want it so when I select from the combo box, the data
is sorted by First_Name. At the moment it just uses the
order that it is in the table.
 
1. Open the form in design view.

2. Right-click the combo and choose Properties.

3. Click in the RowSource property (Data tab of Properties box).

4. Click the Build button beside this (...).
Answer Yes, you do want to invoke the query builder.

5. Drag the fields into the query design window.
Under the First_Name field, in the Sorting row, choose Ascending.

6. Close the query design window, answering Yes to save the change.
 
Thanks for that Allen,

I have done what you suggested, and it is working a treat.

The only problem that I have is that sometimes the
First_Name column can have duplicated names, but the
combo will only use the first name and service code that
is sees.

Is there anything that I can do about this??
 
The table that supplies the names to the combo should have a primary key so
you can tell the difference between Fred Smith and Fred Jones. The bound
column of the combo should be the primary key field, not the name.

If that is not what you want, you can deduplicate the records in the combo
by going back into the query builder. Then open the Properties box (View
menu), and answer Yes beside the property Unique Values.
 
Back
Top