编程开发 > ACCESS > 文章内容

用ACCESS导出EXCEL表格

2011-10-13编辑:mal
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


十万条Access数据表分页的两个解决方法

热点推荐

登录注册
触屏版电脑版网站地图