Sort file names with DIR function in VBAccess 97

crabius
08-29-2000, 10:34 AM
Hello,

I'm trying to use some filenames, sorted by name. I use the DIR function to get them, but there is no sorting properties. I have read in the help file that the answer is to create an array, put the names in it, and then sort them.
But with my level, It's easier said than done. Moreover, I don't have much time to learn this, cause I'm at the end of my training period, and I have already learnt a thousand of other things !!!
So, could I have a little listing that performs this ?

Thank you by advance

P.S. : I have already checked all the questions on the 101 pages, but I haven't found anything interesting.

BillSoo
08-29-2000, 12:56 PM
Depending on how many files we are talking about, a simple way of sorting is to load all the entries into a listbox control and turn on the sorted property.

dim s$

listbox1.clear
listbox1.sorted = true
s$ = dir$("*.*")
while len(s$)
listbox1.additem s$
s$ = dir$
wend

OOPS! I just realized that you are talking about VBA instead of VB. Oh well...maybe this will help anyways.


"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder

TheOnly
08-29-2000, 03:34 PM
Hi !!!
Look at MS
http://support.microsoft.com/support/kb/articles/Q133/1/35.asp

you can use this also for Access

Martin

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum