Hi guys,
I made a database that in one of the forms, I like by clicking on a button the user be able to select 5 excel files with different file names (in the same directory) and then based on the imported file's names, it be stored in 5 different tables.
At the moment by using the bellow code, I can import multiple files (with the same formats) only into one table
. My vba code comes as follow:
Function GetAllFiles()
Dim fd As Object
Dim strFilter As String
Dim lngItems As Long
Const msoFileDialogOpen As Long = 3
Const msoFileDialogViewDetails As Long = 2
Set fd = FileDialog(msoFileDialogOpen)
With fd
.AllowMultiSelect = True
.InitialView = msoFileDialogViewDetails
.InitialFileName = "E:\Planning"
.Title = "Select your file(s)"
.Filters.Clear
.Filters.Add "All Files", "*.*"
.Show
End With
For lngItems = 1 To fd.SelectedItems.Count
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "1", fd.SelectedItems(lngItems), True
Next
End Function
Any helps will be appreciated.
I made a database that in one of the forms, I like by clicking on a button the user be able to select 5 excel files with different file names (in the same directory) and then based on the imported file's names, it be stored in 5 different tables.
At the moment by using the bellow code, I can import multiple files (with the same formats) only into one table

Function GetAllFiles()
Dim fd As Object
Dim strFilter As String
Dim lngItems As Long
Const msoFileDialogOpen As Long = 3
Const msoFileDialogViewDetails As Long = 2
Set fd = FileDialog(msoFileDialogOpen)
With fd
.AllowMultiSelect = True
.InitialView = msoFileDialogViewDetails
.InitialFileName = "E:\Planning"
.Title = "Select your file(s)"
.Filters.Clear
.Filters.Add "All Files", "*.*"
.Show
End With
For lngItems = 1 To fd.SelectedItems.Count
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "1", fd.SelectedItems(lngItems), True
Next
End Function
Any helps will be appreciated.
