首页 > 解决方案 > Format changes importing to access from excel

问题描述

I am importing data from excel into Access and, for some of the files, my 11 digit data starting with 2 leading 0s will be trimmed to 9 without the leading 0s and it's messing up my SQL queries. I double check and I'm certain that the cells are correct in the original excel file. How do I prevent trimming when it imports? Alternatively, how do I change the format of the column to force it to be 11 digits? I couldn't see that as an option in the ribbon.

Below is the code I'm using to import:

Public Sub ImportXLSS(fileName As String, tableName As String)
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, tableName, fileName, True
End Sub

标签: excelvbams-access

解决方案


推荐阅读