Public Sub pfImport()
On Error GoTo Err_F
Dim db As DAO.Database
Dim strPathFile As String, strFile As String, strPath As String,
strSpec As String
Dim strTable As String, ynFieldName As Boolean
Set db = CurrentDb
ynFieldName = False
strPath = "C:\TextFiles\" 'where my files are located
strTable = "NotepadTable" 'the name of my Access table
strFile = Dir(strPath & "*.txt")
Do While Len(strFile) > 0
strPathFile = strPath & strFile
DoCmd.TransferText acImportDelim, strSpec, strTable, strPathFile,
ynFieldName
db.Execute "UPDATE NotepadTable SET FileName = '" & strFile & "' " _
"WHERE FileName Is Null", dbFailOnError
' Uncomment out the next code step if you want to delete the
'file after it's imported
' Kill strPathFile
strFile = Dir()
Loop
Cleanup:
Set db = Nothing
Exit Sub
Exit_F:
Resume Cleanup
Exit Sub
wrote in message
news:a4aa6a29-caf7-4d3e...@v2g2000vbv.googlegroups.com...