Results 1 to 11 of 11

Thread: problem with strings, code included

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member schuurke28's Avatar
    Join Date
    Feb 2001
    Posts
    402

    Exclamation problem with strings, code included

    i need to get information from different records in one record.
    There are some restrictions:
    the first character of the record must be the same
    the second until the 21st character must be the same
    the information i have to put together starts from position 33
    the startposition of this information may never be the same.
    i.e.:
    0800100
    0800100
    In the attachement you will find the begin situation and the desired situation.


    This is the code i'v made this far:

    Sub Main()
    Dim i As Integer

    sOldfile1 = "c:\floreac\flores2.txt"
    sFile2 = "c:\floreac\flores2.dat"
    Open sOldfile1 For Input As #1
    Open sFile2 For Output As #2

    Line Input #1, sstring
    sTOREString = sstring
    Do While Not EOF(1) ' Check for end of file.

    Line Input #1, sstring

    strTempstring = Mid(sTOREString, 22, 61)
    strTempstring2 = Mid(sstring, 22, 61)
    lengte1 = Len(RTrim(strTempstring))
    lengte2 = Len(RTrim(strTempstring2))

    If (Left(sTOREString, 15) = Left(sstring, 15)) Then
    If (Mid(sTOREString, 16, 6) = Mid(sstring, 16, 6)) Then
    If (Left(sTOREString, 1) = Left(sstring, 1)) Then
    If (lengte1 <> lengte2) Then

    header = Mid(sTOREString, 2, 20)
    links = RTrim(strTempstring)
    rechts = LTrim(strTempstring2)
    sTOREString = header & links & rechts
    Debug.Print sTOREString

    End If
    End If
    Else
    Print #2, sTOREString
    sTOREString = sstring
    End If

    End If


    Loop


    Close #1
    Close #2



    End Sub
    Attached Files Attached Files
    Last edited by schuurke28; May 15th, 2001 at 03:15 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width