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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top