sort value list listbox

spinkung

Registered User.
Local time
Today, 14:56
Joined
Dec 4, 2006
Messages
267
Hi All,

I have a list box set to value list which i have filled with the files of a directory (where i send reports).

so it looks like this:
Date..........Title......................Ext........actual path(this is hidden)
12.10.09.....Report Name...........pdf........c:\blah blah\date Report Name.ext
13.10.09.....Report Name...........pdf........c:\blah blah\date Report Name.ext
01.10.09.....Report Name...........pdf........c:\blah blah\date Report Name.ext

The date, title and ext are all string functions from the file name. What i'd like to do is sort by date desc. Does anyone have any idea how this is done??

Thanks.
 
Instead of using a value list why don't you save the contents to a temp table and sort on the date. You can always delete the table contents prior to populating the list.

David
 
thanks david,

how do i pass a table into a function???

i have this so far:
Code:
Public Function ListFiles(strPath As String, Optional strFileSpec As String, _
    Optional bIncludeSubfolders As Boolean, Optional lst As ListBox, Optional ByVal tmp_tbl As TableDefs)

used lik this:
Code:
Call ListFiles(GetXcelPath & "Weekly Ops", , , Me.lst_Reports, tbl_TEMP_wk_ops_reports)
...but i keep getting an object required error which doesn't appear when i take the table out.

thanks.
 
Here is a demo that gets files form a known folder and places them a table then a list box

Also would need to see more of your code to show you how to manipulate it to work correctly

David
 

Attachments

thanks david,

i managed to use what you gave me and get my list box to sort by date.

chuffed :)
 

Users who are viewing this thread

Back
Top Bottom