Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Visual Basic ( VB ) (http://www.go4expert.com/forums/visual-basic/)
-   -   sorting fields (http://www.go4expert.com/forums/sorting-fields-t11673/)

vb6ramirez 27Jun2008 05:41

sorting fields
 
hi, i try to sort a file by the case and all the "A" AND then the "I"

this is my input file
20010301337,maximino Mendez,a
20010301509,carlos Rios,a
20010302143,florencia Morales,i
20010302242,israel Roman,a
20010302471,luis Barreto,a
20010302948,awilda Cubero ,i
20010303205,consorcia Hernandez ,a
20010303277,hector Nieves,a
20010303919,emilio Morales ,a
20010304085,carlos Nieves ,a
20010304441,luis Igartua,a
20010305264,luis Giraud ,a
20010305326,trinidad Rivera ,a
20010320014,jose Martinez,a
20010320056,antonio Ocasio,a
20010320083,antonio Perez,i

This Is The Report That I Want

20010301167 Roberto Adames A
20010301337 Maximino Endez A
20010301509 Carlos Rios A
20010302242 Israel Roman A
20010302471 Luis Barreto A
20010303205 Consorcia Del A
20010303277 Hector Nieves A
20010303919 Emilio Morales A
20010304085 Carlos Nieves A
20010304441 Luis Igartua A
20010305264 Luis Giraud A
20010305326 Trinidad Rivera A
20010320014 Jose Martinez A
20010320056 Antonio Ocasio A
20010302143 Florencia Morales I
20010302948 Awilda Cubero I
20010320083 Antonio Perez I


THIS IS SORTING CODE
Code:

For Loop1 = 0 To total
    pos = Loop1
    For loop2 = Loop1 + 1 To total
        If caso1(loop2) = caso1(pos) And status1(loop2) < status1(pos) Then
            pos = loop2
        End If
    Next loop2
    If pos <> Loop1 Then
        Tmp = caso1(pos)
        caso1(pos) = caso1(Loop1)
        caso1(Loop1) = Tmp
       
        Tmp = falta1(pos)
        falta1(pos) = falta1(Loop1)
        falta1(Loop1) = Tmp
       
        Tmp = nombre1(pos)
        nombre1(pos) = nombre1(Loop1)
        nombre1(Loop1) = Tmp
       
           
        Tmp = status1(pos)
        status1(pos) = status1(Loop1)
        status1(Loop1) = Tmp
       
       
       
    End If
Next Loop1

THANKS FOR YOUR HELP

jwshepherd 19Jul2008 01:56

Re: sorting fields
 
try using the ADODB connector for text file and you can sort them any way ou would like.


All times are GMT +5.5. The time now is 17:04.