Thanks again for the response, I've had a work on it and got it to add the correct path for the document, but unfortunately it does this only adds this data for the top import. I'm sure it's something very simple, but I'm not quite sure what it is:
Code:
Private Sub bImportFiles_Click()On Error GoTo bImportFiles_Click_Err
Dim objFS As Object, objFolder As Object
Dim objFiles As Object, objF1 As Object
Dim strFolderPath As String
Dim rs As dao.Recordset
Dim db As dao.Database
strFolderPath = "C:\Users\zigex\Documents\Super Project\testfiles\"
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFS.GetFolder(strFolderPath)
Set objFiles = objFolder.files
For Each objF1 In objFiles
If Right(objF1.Name, 3) = "txt" Then
DoCmd.TransferText acImportDelim, "Monthly Import Specification", "monthlyimport", strFolderPath & objF1.Name, False
Set db = CurrentDb
Set rs = db.OpenRecordset("monthlyimport", dbOpenDynaset)
rs.Edit
rs.Fields(8) = strFolderPath & objF1.Name
rs.Update
rs.Close
db.Close
''Name strFolderPath & objF1.Name As "C:\Users\zigex\Documents\Super Project\archive" & objF1.Name 'Move the files to the archive folder
End If
Next
Set objF1 = Nothing
Set objFiles = Nothing
Set objFolder = Nothing
Set objFS = Nothing
Me.Refresh
bImportFiles_Click_Exit:
Exit Sub
As always, any help would be appreciated!