R
Rick Vooys
Hello Gurus
I can't seem to wrap my brain around some logic here, I
have a comma delimited file which I need to parse and put
into a table. I can get the data into the table but I
can't seem to parse the data properly. Each record is two
lines, so at field 11 I must read in the second line. I
can't seem to pull only the data, I always pull put a
comma also, and if I get only the data fields with 1
character are skipped too. My problem occurs with fields
that are empty and in the file produce ,,, my code skips
right over them, here is my code
'Note there is no loop because I am trying to
understand 'why it doesn't work
intSearchStart = 1
intSearchEnd = InStr(intSearchStart,
strInputLine, ",")
intSearchLength = intSearchEnd -
intSearchStart
strField1 = Mid(strInputLine,
intSearchStart, intSearchLength)
intSearchStart = intSearchEnd
intSearchEnd = InStr(intSearchStart +
1, strInputLine, ",")
intSearchLength = intSearchEnd -
intSearchStart
strField2 = Mid(strInputLine,
intSearchStart, intSearchLength)
intSearchStart = intSearchEnd
' contine reading in each field until 11
intSearchEnd = InStr(intSearchStart + 1, strInputLine, ",")
intSearchLength = Len(strInputLine) -
intSearchStart - 1
strField11 = Mid(strInputLine,
intSearchStart, intSearchLength)
intSearchStart = intSearchEnd + 1
Line Input #1, strInputLine
strTestFileData = strInputLine
intSearchStart = 1
intSearchEnd = InStr(intSearchStart,
strInputLine, ",")
intSearchLength = intSearchEnd -
intSearchStart
strField12 = Mid(strInputLine,
intSearchStart, intSearchLength)
intSearchStart = intSearchEnd + 1
Any help would be awesome, I am desperatley trying
everything now!!
I can't seem to wrap my brain around some logic here, I
have a comma delimited file which I need to parse and put
into a table. I can get the data into the table but I
can't seem to parse the data properly. Each record is two
lines, so at field 11 I must read in the second line. I
can't seem to pull only the data, I always pull put a
comma also, and if I get only the data fields with 1
character are skipped too. My problem occurs with fields
that are empty and in the file produce ,,, my code skips
right over them, here is my code
'Note there is no loop because I am trying to
understand 'why it doesn't work
intSearchStart = 1
intSearchEnd = InStr(intSearchStart,
strInputLine, ",")
intSearchLength = intSearchEnd -
intSearchStart
strField1 = Mid(strInputLine,
intSearchStart, intSearchLength)
intSearchStart = intSearchEnd
intSearchEnd = InStr(intSearchStart +
1, strInputLine, ",")
intSearchLength = intSearchEnd -
intSearchStart
strField2 = Mid(strInputLine,
intSearchStart, intSearchLength)
intSearchStart = intSearchEnd
' contine reading in each field until 11
intSearchEnd = InStr(intSearchStart + 1, strInputLine, ",")
intSearchLength = Len(strInputLine) -
intSearchStart - 1
strField11 = Mid(strInputLine,
intSearchStart, intSearchLength)
intSearchStart = intSearchEnd + 1
Line Input #1, strInputLine
strTestFileData = strInputLine
intSearchStart = 1
intSearchEnd = InStr(intSearchStart,
strInputLine, ",")
intSearchLength = intSearchEnd -
intSearchStart
strField12 = Mid(strInputLine,
intSearchStart, intSearchLength)
intSearchStart = intSearchEnd + 1
Any help would be awesome, I am desperatley trying
everything now!!