Sorting Access drop downs

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

Guest

Is there a way to sort drop down lists at execution time? The list contains
four fields -- Key, Last Name, First Name, and Department. The drop-down is
in key sequence. I need to sort it into Last Name, First Name sequence. The
key will be stored in the primary table, referencing the entries in the Name
table.
 
Hi, Jim.

Just add an ORDER BY clause to the RowSource of the combo box. Something
like:

SELECT Emp.Key, Emp.LastName, Emp.FirstName, Emp.Department FROM Emp
ORDER BY Emp.LastName, Emp.FirstName

Hope that helps.
Sprinks
 
Is there a way to sort drop down lists at execution time? The list contains
four fields -- Key, Last Name, First Name, and Department. The drop-down is
in key sequence. I need to sort it into Last Name, First Name sequence. The
key will be stored in the primary table, referencing the entries in the Name
table.

Certainly. Base the Combo Box ("dropdown") on a Query, rather than
directly on the table; specify any sort order you like in that query.

For example, you might set the combo's Row Source property to

SELECT Key, [Last Name] & ", " & [First Name], Department
FROM [the-table-name]
ORDER BY [Last Name], [First Name];

If you then set the combo's Column Count to 3, the Bound Column to 1,
and the Column Widths to

0";1.25";.75"

you'll see the name (in the format "Worden, Jim") and the department,
but the computer will see and store the key.

John W. Vinson[MVP]
 
Jim said:
Is there a way to sort drop down lists at execution time? The list contains
four fields -- Key, Last Name, First Name, and Department. The drop-down is
in key sequence. I need to sort it into Last Name, First Name sequence. The
key will be stored in the primary table, referencing the entries in the Name
table.

Jim, Kristi A. says that you should get back to work.
 

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

Similar Threads

rolodex 2
List Box Problem 2
Access 2007 - Table A lookup values based on Table B 1
Combobox column 1 6
Replicate Sort Order 1
Search by first or last name 2
Limit to Records in a drop down box? 2
List Boxes 5

Back
Top