Import text file into access

D

DRSpok

I want to put certain parts of a text file into a record in an Access table,
then repeat the process several hundred times. What is the best way to
accomplish this?
 
P

pietlinden

Or you could do something like this, which requires an import
specification, but no other references and especially not the
Scripting Runtime.

Public Sub ProcessDirectory(ByVal strPath As String)
Dim strFileName As String
strFileName = Dir(strPath & "\Data*.txt")
Do Until strFileName = ""
Debug.Print strFileName
DoCmd.TransferText acImportDelim, "Data1 Import
Specification", "LineItemData", strFileName, False
strFileName = Dir
Loop

Debug.Print "Transfer complete"
End Sub

You could get the path using BrowseFolderAPI from Access web... www.mvps.org
 
Top