我目前正在从 ms 访问执行此代码,该代码从 SQL 服务器调用存储过程以创建临时表并将该表中的数据直接导出到 Excel 工作簿。我现在希望将表单中的两个日期字段作为此过程的参数(dateOpen、dateClose)。我该怎么做?
Dim rst As New ADODB.Recordset
Dim cmd1 As New ADODB.Command
Dim cmd2 As New ADODB.Command
Dim cmd3 As New ADODB.Command
With cmd1
.ActiveConnection = CurrentProject.connection
.CommandText = "usp_tbl_close"
End With
Set rst = cmd1.Execute
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "dbo.close", "C:\Documents\testio3.xls", True, "close"