Here is my code. It transfers multiple excel sheets into one access table called invoice. Problem is sme of the excel tables have a mix of character and numeric data in the same field (ie ID_Num,Prod_ID). These are supposed to be character fields. Example data is 1232 2321a 2233ee. How can I address this using the code I have below programmatically instead of sifting through 90 excel spreadsheets and manually changing the data types to character.
Sub transferMult()
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 EXCEL worksheet
' has field names
blnHasFieldNames = True
' Real path of the excel file location
strPath = "C:\pcsas_export_files\Quest\"
' Assign a tablename
strTable = "invoice"
'The actual file directory that will reference the set of files to be imported
strFile = Dir(strPath & "*.xls")
Do While Len(strFile) > 0
strPathFile = strPath & strFile
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
strTable, strPathFile, blnHasFieldNames
' Uncomment out the next code step if you want to delete the
' EXCEL file after it's been imported
' Kill strPathFile
strFile = Dir()
Loop
End Sub
Sub transferMult()
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 EXCEL worksheet
' has field names
blnHasFieldNames = True
' Real path of the excel file location
strPath = "C:\pcsas_export_files\Quest\"
' Assign a tablename
strTable = "invoice"
'The actual file directory that will reference the set of files to be imported
strFile = Dir(strPath & "*.xls")
Do While Len(strFile) > 0
strPathFile = strPath & strFile
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
strTable, strPathFile, blnHasFieldNames
' Uncomment out the next code step if you want to delete the
' EXCEL file after it's been imported
' Kill strPathFile
strFile = Dir()
Loop
End Sub