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
Question
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.
La 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
Autres conseils
Do a UNION
with the value you want to add:
SELECT EntryID FROM urTable
UNION
SELECT (Max(EntryID) + 1) FROM urTable