Hello,
I currently import 50 - 80 excel files to access using the code shown below. Unfortunately, some of the records on the files are missing information. This creates a nightmare when I try to find which excel file has the incorrect or missing information. Is there a way to add the file name to each record when the data is imported from excel? Any assistance would be truly appreciated.
Dim strPathFile As String, strFile As String, strPath As String
Dim strTable As String
Dim blnHasFieldNames As Boolean
blnHasFieldNames = False
strPath = "h:\letters\_ADHOCS to UHGPS\Batch 5 Std Prov Terms\COSMOS MAILINGS\"
strTable = "sheet1"
strFile = Dir(strPath & "*.xls")
Do While Len(strFile) > 0
strPathFile = strPath & strFile
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
strTable, strPathFile, blnHasFieldNames
strFile = Dir()
Loop
I currently import 50 - 80 excel files to access using the code shown below. Unfortunately, some of the records on the files are missing information. This creates a nightmare when I try to find which excel file has the incorrect or missing information. Is there a way to add the file name to each record when the data is imported from excel? Any assistance would be truly appreciated.
Dim strPathFile As String, strFile As String, strPath As String
Dim strTable As String
Dim blnHasFieldNames As Boolean
blnHasFieldNames = False
strPath = "h:\letters\_ADHOCS to UHGPS\Batch 5 Std Prov Terms\COSMOS MAILINGS\"
strTable = "sheet1"
strFile = Dir(strPath & "*.xls")
Do While Len(strFile) > 0
strPathFile = strPath & strFile
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
strTable, strPathFile, blnHasFieldNames
strFile = Dir()
Loop