combo box in alphabetical order

P

PattiP

I'm sure there's a simple solution to this, but I can't seem to figure it out:
I have a combo box on a form and I would like the drop-down list to be in
ascending order by the field name rather than the auto ID order. The field
names are showing, but they're not in alphabetical order. I couldn't find
any place in the properties box that gives me the option.

Patti
 
J

John Vinson

I'm sure there's a simple solution to this, but I can't seem to figure it out:
I have a combo box on a form and I would like the drop-down list to be in
ascending order by the field name rather than the auto ID order. The field
names are showing, but they're not in alphabetical order. I couldn't find
any place in the properties box that gives me the option.

Patti

Base the combo box on a Query sorting the data as you wish to see it.

To do so, view the combo's properties; click the ... icon by the
RowSource property, and accept Access' offer to open the table as a
Query. Select Ascending on the order by property of the field, and
close the query window, accepting Access' offer to update the SQL
property.

John W. Vinson[MVP]
 
S

Sandra Daigle

Open the rowsource query and in the column for the name field select a sort
order.
 
G

Graham Mandeno

Hi Patti

This is because you are using your table directly as the rowsource for the
combobox, so the records are returned in order of the primary key.

Create a query based on your table. Include the ID field and the name
field, and sort on the name field. Then use your query as the rowsource
instead of the table.

Or, you can write the query SQL directly into the rowsource property:
Select [IdField], [NameField] from [YourTable] order by [NameField];
 
O

Ofer

Open the Row Source property of the combo box, and set the order by the field
name in the SQL (query)

Select ID , [field name] From TableName Order By [field name]
 
Top