ms-accesscomboboxvbams-access-2010form-load

Display an ascended value in a combobox on form load in Access (default value)


So on a form I have, I'm using a combobox (unbound), with the row source being linked to EntryID, which is being pulled from a different table. Currently, EntryID has values 1 to 300, with 1 being the oldest entry and 300 being the newest entry added.

I use the values in the combobox to requery subforms I'm using on this form. Obviously all tables that the subforms reference have the EntryID populated on them.

How can I populate the newest value in the combobox on form load? I can sort the values in ascending or descending order, but that is only after you click the down arrow on the combobox.


Solution

  • If you use a query for the combo's Row Source, you can do your sorting in the query by adding this after the WHERE clause ...

    ORDER BY EntryID DESC