Link to home
Start Free TrialLog in
Avatar of strongd
strongdFlag for United States of America

asked on

Sorting Files

How do you sort a file in VB.  I need to sort a file like the way Unix sorts a file with the sort command or the way NT sorts by passing the function sort a file name and a column to sort....  Please tell me if there is a function in VB or a control or someone who has a function they built....Thanks
Avatar of wsh2
wsh2

You can sort the File when you create your recordset by using your OpenRecordSet SQL statement..

Dim dbDemo as Database
Dim rsDemo as Recordset

Set dbDemo = OpenDatabase("Nwind.mdb")
Set rsDemo = dbDemo.OpenRecordSet ( _
  "SELECT * FROM Employees ORDER BY LastName, FirstName", _
  dbOpenDynaset, _
  dbReadOnly)
   
Your Recordset will then appear in that order.
How does it work in Unix/NT, does the column 2 mean from character 2 to end of line (as the sort command looks like in Win95) or does column 2 mean that the program reads the empty lines and figures out where column2 might be... If you can tell me I can probably make a function for ya, it sounds like a easy task. ;)
ASKER CERTIFIED SOLUTION
Avatar of mcrider
mcrider

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
By the way, Don't you think the above code is worth more that 50 points?? ;-)


Cheers!®©