Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Sort file names with DIR function in VBAccess 97


Reply
 
Thread Tools Display Modes
  #1  
Old 08-29-2000, 10:34 AM
crabius
Guest
 
Posts: n/a
Default Sort file names with DIR function in VBAccess 97


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.

Reply With Quote
  #2  
Old 08-29-2000, 12:56 PM
BillSoo's Avatar
BillSoo BillSoo is offline
Code Meister

Retired Moderator
* Guru *
 
Join Date: Aug 2000
Location: Vancouver, BC, Canada
Posts: 10,441
Default Re: Sort file names with DIR function in VBAccess 97

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
__________________
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
Reply With Quote
  #3  
Old 08-29-2000, 03:34 PM
TheOnly
Guest
 
Posts: n/a
Default Re: Sort file names with DIR function in VBAccess 97

Hi !!!
Look at MS
http://support.microsoft.com/support.../Q133/1/35.asp

you can use this also for Access

Martin

Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->