Text Import - remove carriage returns

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a large text file (approx 7 Mb) which I import into Access using the
following:

Do Until lineEnd >= Len(strImport)
For lineEnd = (lineStart + 10) To Len(strImport)
If Mid$(strImport, lineEnd, 10) Like "##/##/####" Then
Exit For
End If
Next lineEnd

strline = Mid$(strImport, lineStart, lineEnd - lineStart)
Debug.Print strline

rstImportTable.AddNew
rstImportTable.Fields("Date") = Left(strline, 10)
rstImportTable.Fields("TimeStamp") = Right(Left(strline, 19), 8)
rstImportTable.Fields("decimal") = Mid$(strline, 20, 4)
rstImportTable.Fields("Data") = Mid$(strline, 24, (Len(strline) - 24))
rstImportTable.Update

Each line is identified by a date followed by a time and then the data.
This text file is exported from another system daily and creates a log text
file from which I import...

I have however found that when a line is read that has a number of carriage
returns only the first line is read and the remainder ignored before the next
date value.... despite the count of the number of characters in strImport
being correct and the debug printing as expected

Am I missing something ??? Any Suggestions would be appreciated

Many Thanks
 
Please Disregard ....

Managed to solve the problem by replacing the carriage returns with a space...

Many Thanks anyways
 
Back
Top