Subject: Text File-Newbie VBA Access
Posted By: mbeirn Post Date: 10/6/2005 7:08:39 AM
Hello All,

  How does Access VBA read text files?  What characters determines the end of record? end of file?
Is there a limit to the size of text files?

Thanks for any help.
Matt
Reply By: mbeirn Reply Date: 10/6/2005 7:18:45 AM
Here is my text processing code (this is the basic functions I'm using)

    Select Case Me.OpenMode
        Case tfOpenReadOnly
            If Me.AutoCreate Then
                Open Me.Path For Binary Access Read As mhFile
            Else
                Open Me.Path For Input Access Read As mhFile
            End If
        Case tfOpenReadWrite
            Open Me.Path For Binary Access Read Write As mhFile
        Case tfOpenAppend
            Open Me.Path For Append Access Read Write As mhFile
        Case Else
            ' Bad value of OpenMode, throw an error
            Err.Raise conErrInvalidProcCall
    End Select


    If Me.IsOpen Then
        hFile = Me.Handle
        If Not VBA.EOF(hFile) Then
            Line Input #hFile, mstrCurrentLine
            ReadNext = True
        End If
    End If

    Line Input #hFile, mstrCurrentLine

Go to topic 35456

Return to index page 458
Return to index page 457
Return to index page 456
Return to index page 455
Return to index page 454
Return to index page 453
Return to index page 452
Return to index page 451
Return to index page 450
Return to index page 449