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

MK1999

New member
Local time
Tomorrow, 02:32
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, 19:32
Joined
Jan 23, 2006
Messages
15,364
What is the rowsource of the listbox?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 23:32
Joined
Feb 19, 2013
Messages
16,553
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