sorting fields

Discussion in 'Visual Basic ( VB )' started by vb6ramirez, Jun 27, 2008.

  1. vb6ramirez

    vb6ramirez New Member

    Joined:
    Jun 27, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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
     
    Last edited by a moderator: Jun 27, 2008
  2. jwshepherd

    jwshepherd New Member

    Joined:
    Aug 13, 2007
    Messages:
    135
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    VP Technology Corporation
    Location:
    Texas
    Home Page:
    http://www.officialhackers.com
    try using the ADODB connector for text file and you can sort them any way ou would like.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice