程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Access數據庫 >> 關於Access數據庫 >> 用ACCESS導出EXCEL表格

用ACCESS導出EXCEL表格

編輯:關於Access數據庫

  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

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved