Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004
    Location
    Australia
    Posts
    183

    Question Unanswered: Count lines help?

    Hi guys,
    this is the code I am using to create a txt file that gets imported into a certain external database.

    nOut = FreeFile
    Open "C:\temp\" & szName For Output As #nOut

    '* Print the header.
    Print #nOut, "ISA*" & szDate & "*" & szTime
    Print #nOut, "GS*CN"
    Print #nOut, "ST*"

    '* Print the body.
    lCount = 3
    Do While rsPrint.EOF = False
    Print #nOut, "CN*" & szDate & "*" & szTime & "*" & _
    "O*" & rsPrint("JobNo") & "*" & rsPrint("FirstName") & " " & rsPrint("LastName") & "*" & _
    rsPrint("Address1") & "*" & rsPrint("Address2") & "*" & rsPrint("Address3") & "*" & rsPrint("Address4") & "*" & _
    rsPrint("City") & "*" & _
    rsPrint("State") & "*" & rsPrint("PostCode") & "**" & rsPrint("phone") & "***" & _
    rsPrint("JobNo") & "********"
    Print #nOut, "CL*" & rsPrint("refNo") & "*" & rsPrint("MOdel") & "*" & "1*" & rsPrint("ItmWeight") & "***"
    Print #nOut, "SE**2"
    lCount = lCount + 3
    rsPrint.MoveNext
    Loop

    '*Print the footer
    HERE I NEED TO HAVE something that will count the number of ST lines(that is part of the header) only and gives the result under this GE line below,not sure how to do this count
    Print #nOut, "GE*"
    Print #nOut, "IEA*" & CStr(lCount + 1)
    Print #nOut, Chr$(12)
    Close #nOut

    As you can see I have one lCount that loops through the file and gives the number of lines in the file.

    I was hoping somebody could help me with that

  2. #2
    Join Date
    May 2004
    Posts
    19
    Your email is not very clear -to me- what are the ST lines? You have to find what is characterising the ST lines in order to count them.
    Sorry.

Posting Permissions

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