运行时错误'3190' 定义的字段太多
当我点击调用DoCmd.TransferSpreadsheet中的查询的按钮时,我收到此错误:
'------------------------------------------------------------
' Creates the excel file in the path passed to it
' Returns the path of the file including the file name and extension
'------------------------------------------------------------
Function CreateExcelFile(Path As String) As String
Dim outputFileName As String
outputFileName = Path & "SummaryTemplate.xlsx"
Dim Queries(1 To 4) As String
Queries(1) = "qryProcessAuditScores" 'Audit scores
Queries(2) = "qryProcessAuditStations" 'Audit Stations
Queries(3) = "qryProcessNCs" 'Number of NC's
Queries(4) = "qryProcessAuditCount" 'number of audits from the year
Dim qry
For Each qry In Queries
DoCmd.TransferSpreadsheet _
acExport, _
acSpreadsheetTypeExcel12, _
qry, _
outputFileName, _
True
Next
CreateExcelFile = outputFileName 'return the full path
End Function
当我在Access中手动运行查询时,我没有收到此类错误。我没有运气就试过Compact和Repair Database。还有其他想法吗?
由于
答案 0 :(得分:0)
我最终运行sql命令将查询放入表中,使用这些表运行TransferSpreadsheet,然后运行sql命令删除表。