Sorting Access drop downs

J

Jim Worden

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.
 
S

Sprinks

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
 
J

John Vinson

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]
 
M

Mac

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.
 
Top