This will import multiple .txt files into a Table; if you only have one .txt
file then the end result should be the same...and if you want to import
several files someday you have it when you need it...
Sub ImportAllExcelFiles()
On Error GoTo Err_F
Dim strPathFile As String, strFile As String, strPath As String, strSpec As
String
Dim strTable As String, ynFieldName As Boolean
ynFieldName = False
strPath = "C:\Documents and Settings\ThinkPad\Desktop\Import\"
'strSpec = "NameOfImportSpecification" ' Put your name here
strTable = "tablename"
strFile = Dir(strPath & "*.txt")
Do While Len(strFile) > 0
strPathFile = strPath & strFile
DoCmd.TransferText acImportDelim, strSpec, strTable, strPathFile, ynFieldName
' Uncomment out the next code step if you want to delete the file after it's
imported
' Kill strPathFile
strFile = Dir()
Loop
Exit_F:
Exit Sub
Err_F:
MsgBox Err.Number & " " & Err.Description
Resume Exit_F
End Sub
Regards,
Ryan---