Alphabetical order in combo box

J

Jonathan

I have a combo box tied to a table. The table is in alphabetical order but
the combo box is not. How can I get the text in the "pull down" to be in
alphabetical order?
 
K

Klatuu

Use ordering in the rowsource property of the combo. My perference is to use
an SQL statement as the row source for combos. That means fewer objects to
keep track of, and easier to manipulate.
SELECT SomeField FROM ATable ORDER BY SomeField

If you want more than one column in the combo
SELECT SomeField, AnotherField FROM ATable ORDER BY SomeField

And if you want it in Z-A (Descending Order)
SELECT SomeField FROM ATable ORDER BY SomeField DESC
 
W

Wayne-I-M

Hi Jonathan

On the rowsource of the combo you need to add the ORDER BY action
Something like this

SELECT Table.Field1, Table.Field2, Table.Field3, Table.Field4 FROM tblTable
ORDER BY [Field2];
 
R

RoyVidar

ManningFan said:
Rather than listen to those 2 guys, I'd just use the ORDER BY clause
in your recordset property.

Could you please tell us how to do that?

While doing that, please also tell how the recordset property of the
combo came into the equotation in the first place.
 
M

ManningFan

Rather than listen to those 2 guys, I'd just use the ORDER BY clause in
your recordset property.
 
J

Jonathan

Where do I find "recordset property"?
--
Thank You,
Jonathan


ManningFan said:
Rather than listen to those 2 guys, I'd just use the ORDER BY clause in
your recordset property.
 
J

John Vinson

Where do I find "recordset property"?

It's actually the "Row Source" property; view the combo's properties,
it's up near the top.

It might be a table; if so click the ... icon and accept Access' offer
to make it into a Query. Specify the sort order in this query and
close the query grid window, accepting Access' offer to save the SQL.
This Query will produce a "recordset" - the set of records in
alphabetical order which are displayed in the combo.

John W. Vinson[MVP]
 

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