I have a combo box in Access and it contains a list of the field names from one of my tables. However, it is unordered and I don't know how to order it when field names is selected as its source. How can I order this alphabetically?
EDIT:
开发者_如何学编程To clarify here are the settings I'm using in the properties menu.
I don't think there is a straightforward way to do this.
If the column names aren't going to change, then of course you could copy them to out to excel, sort them and add them back into the combobox as a value list (instead of field list).
If you want a solution that avoids hardcoding the fields, all I can think of is to change the combobox Row Source Type to Table/Query, and set it to a temporrary table. At time of loading the form then pre-populate the temporary table with the field names of the table, using VBA to get a sorted list of the field names of the table
Bit of a horrible hack, though.
精彩评论