Run-time error '2147024534 (8007016a)' Method 'ReadAll' of object 'ITextStream' failed.

New Contributor

Had to reinstall Office 365 after reloading Windows 11, and now a form that I have used up until yesterday in my ACCESS db doesn't work.

I didn't create the form, but here is the code the debug is pointing to. The particular problematic line is in bold blue:

fileSuffix = Right(StrFile, 3)
If LCase(fileSuffix) = "csv" Then
If thisFile.Size > 0 Then
Set objTextFile = objFSO.OpenTextFile(fullFilename, ForReading)
objTextFile.ReadAll
numLines = objTextFile.Line
If objTextFile.Line <= 2 Then
objTextFile.Close
Set objTextFile = objFSO.OpenTextFile(fullFilename, ForReading)
sampleLine = objTextFile.ReadLine
checkArray = Split(sampleLine, ",")


Does anyone know how I can fix this?

Thank you,

2 Replies
you need a Variable to assign what you have ReadAll.

Dim content As String
Content = objTextFile.ReadAll
...
...

So actually it turns out there were more updates needed - didn't looks to see exactly what they were, just allowed them to run, and that fixed the problem, no code fixes needed. Thanks for replying though....