WEB开发网
开发学院数据库Access 用ACCESS导出EXCEL表格 阅读

用ACCESS导出EXCEL表格

 2009-05-22 14:37:21 来源:WEB开发网   
核心提示:Private Sub Command85_Click() '生成EXCEL表Dim exFile As String, Shellstg As String'导出[XX中学摸底成绩]DoCmd.TransferSpreadsheet acExport, 8, Me.Combo69 & "摸底

Private Sub Command85_Click() '生成EXCEL表

Dim exFile As String, Shellstg As String

'导出[XX中学摸底成绩]

DoCmd.TransferSpreadsheet acExport, 8, Me.Combo69 & "摸底成绩", CurrentProject.Path & "\" & Me.Combo69, False, ""

'导出[XX中学]成绩

DoCmd.TransferSpreadsheet acExport, 8, Me.Combo69, CurrentProject.Path & "\" & Me.Combo69, False, ""

'导出[XX中学摸底单科]

SQL = "Select " & Me.Combo69 & ".*"

SQL = SQL + " FROM " & Me.Combo69 & "摸底成绩 INNER JOIN " & Me.Combo69 & " ON " & Me.Combo69 & "摸底成绩.姓名 = " & Me.Combo69 & ".姓名"

SQL = SQL + " orDER BY " & Me.Combo69 & "摸底成绩.总分 DESC;"

'建立[XX中学摸底单科]查询

On Error Resume Next

Set qdf = CurrentDb.CreateQueryDef(Me.Combo69 & "摸底单科", SQL) '[XX中学摸底单科]

'导出[XX中学摸底单科]

DoCmd.TransferSpreadsheet acExport, 8, Me.Combo69 & "摸底单科", CurrentProject.Path & "\" & Me.Combo69, False, ""

DoCmd.Close

''请注意引号的用法

Shellstg = """c:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE"" """ & CurrentProject.Path & "\招生.XLS" & """"

Call Shell(Shellstg, 1)

End Sub

Tags:ACCESS 导出 EXCEL

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接