sort a list box from newest record to oldest (1 Viewer)

MK1999

New member
Local time
Today, 09:11
Joined
Mar 30, 2022
Messages
24
hello,
i have a list box including program name, year, code when the user click on the search bar the records pop up to the list box
i want to sort the records from the newest one to the oldest (descending order) is there any way to set descending order in the setting or a code that will sort the names by the largest id for example?
 

jdraw

Super Moderator
Staff member
Local time
Today, 02:11
Joined
Jan 23, 2006
Messages
14,318
What is the rowsource of the listbox?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 07:11
Joined
Feb 19, 2013
Messages
14,390
i want to sort the records from the newest one to the oldest (descending order) is there any way to set descending order in the setting or a code that will sort the names by the largest id for example?
apply an order by clause in the listbox rowsource

select somefields from aTable order by afield (desc)

edit: if you want a true order newest to oldest then ordering on the PK is based on when the record was created. The same would apply to a timestamp. If your table is a list of cars and their ages, the records almost certainly would not have been created in order of age if that is what you mean be 'newest to oldest' so you would need to order by age
 
Last edited:

Users who are viewing this thread

Top Bottom