Text Import - remove carriage returns

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
 
G

Guest

Please Disregard ....

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

Many Thanks anyways
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top