T
Texernie1
Hi all,
I hope I am posting to the right MSDN group. I have some code that
loads a text file line by line. It works great. The issue I seem to see is
that it stalls every 500-600 lines and has to wait a second or so. I think
this is related to Access waiting on the system to load the file from disk.
My processing code is pretty effecient and can process lines really quick. I
am wondering if there is a way to look at how much data the OS prefetches
into memory for processing and if there is a way to increase it.
My code to open the file is below.
Sub XYZ (multiple parameters that initialize variables including filename)
Dim DevN As Integer
Dim SSQL, DBase, Tble, FS, CurFile As Variant
Dim CurLine, Temp, Unit, LOF, ProcessLine As Variant
Dim TempLine, ScrapA() As Variant
Set DBase = CurrentDb
Set FS = CreateObject("Scripting.FileSystemObject")
Set CurFile = FS.OpenTextFile(FileN, ForReading, TristateFalse)
While Not (CurFile.AtEndOfStream)
CurLine = CurFile.ReadLine
Wend
LOF = CurFile.Line
CurFile.Close
Set Tble = DBase.OpenRecordset("All Data")
Set CurFile = FS.OpenTextFile(FileN, ForReading, TristateFalse)
CurLine = ""
While UBound(Split(CurLine, ",")) <> 9 ' 10 items in the Desired Header
CurLine = CurFile.ReadLine
Wend
(Some limitied pre-processing and setup done here, but no file processing)
CurLine = CurFile.ReadLine
While Not CurFile.AtEndOfStream
(line processing occurs here)
CurLine = CurFile.ReadLine
Wend
CurFile.Close
End Sub
Thanks in advace for the help.
Regards,
Texernie1
I hope I am posting to the right MSDN group. I have some code that
loads a text file line by line. It works great. The issue I seem to see is
that it stalls every 500-600 lines and has to wait a second or so. I think
this is related to Access waiting on the system to load the file from disk.
My processing code is pretty effecient and can process lines really quick. I
am wondering if there is a way to look at how much data the OS prefetches
into memory for processing and if there is a way to increase it.
My code to open the file is below.
Sub XYZ (multiple parameters that initialize variables including filename)
Dim DevN As Integer
Dim SSQL, DBase, Tble, FS, CurFile As Variant
Dim CurLine, Temp, Unit, LOF, ProcessLine As Variant
Dim TempLine, ScrapA() As Variant
Set DBase = CurrentDb
Set FS = CreateObject("Scripting.FileSystemObject")
Set CurFile = FS.OpenTextFile(FileN, ForReading, TristateFalse)
While Not (CurFile.AtEndOfStream)
CurLine = CurFile.ReadLine
Wend
LOF = CurFile.Line
CurFile.Close
Set Tble = DBase.OpenRecordset("All Data")
Set CurFile = FS.OpenTextFile(FileN, ForReading, TristateFalse)
CurLine = ""
While UBound(Split(CurLine, ",")) <> 9 ' 10 items in the Desired Header
CurLine = CurFile.ReadLine
Wend
(Some limitied pre-processing and setup done here, but no file processing)
CurLine = CurFile.ReadLine
While Not CurFile.AtEndOfStream
(line processing occurs here)
CurLine = CurFile.ReadLine
Wend
CurFile.Close
End Sub
Thanks in advace for the help.
Regards,
Texernie1