SOmrthing is awry with the code below - it cannot find the file to import from even though it appears in the locals window as a variable etc ......
Appreciate your insight and assistance folks!
Appreciate your insight and assistance folks!
Code:
Sub txtfileimport()
Dim strPathFile As String, strFile As String, strPath As String
Dim strTable As String
Dim blnHasFieldNames As Boolean
' Change this next line to True if the first row in Text File
' has field names
blnHasFieldNames = True
strPath = "C:\Users\evansd1\Documents\ACT SJF files\COR\"
' Replace tablename with the real name of the table into which
' the data are to be imported
strTable = "SJF ACT COR"
strFile = Dir(strPath & "*.*.txt")
Do While Len(strFile) > 0
strPathFile = strPath & strFile
DoCmd.TransferText acImportDelim, , strTable, strPathFile, blnHasFieldNames
' Uncomment out the next code step if you want to delete the
' text file after it's been imported
' Kill strPathFile
strFile = Dir()
Loop
End Sub