Wrox Programmer Forums
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 6th, 2005, 07:08 AM
Registered User
Join Date: Oct 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Text File-Newbie VBA Access

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.
Old October 6th, 2005, 07:18 AM
Registered User
Join Date: Oct 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

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
                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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Link a text file to Access using VBA wscheiman Access VBA 1 June 30th, 2013 07:02 PM
vba file access rema Excel VBA 0 August 28th, 2008 05:03 AM
Access VBA - Controlling Text boxes in a form Scripts82 Access VBA 4 February 8th, 2006 08:35 PM
VBA access List data to text file Data-Base Access VBA 6 September 15th, 2005 04:04 PM
import data from text file to excel(VBA) topr Excel VBA 2 August 26th, 2004 11:36 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.