Access 谈谈数据导出语句 DoCmd.OutputTo

发布时间 2023-08-03 18:50:41作者: 一曲轻扬

官方文档:DoCmd.OutputTo 方法 (Access) | Microsoft Learn

看上去挺复杂的,其实主要看第一和第三个参数.不想去研究的朋友,下面这几行代码,应该够用了

'将报表导出为PDF代码
    DoCmd.OutputTo acOutputReport, "报表名称", acFormatPDF, , True
'将报表导出为Excel代码
    DoCmd.OutputTo acOutputForm, "目标名称", acFormatXLS, , True
'将窗体导出为PDF代码
    DoCmd.OutputTo acOutputForm, "目标名称", acFormatPDF, , True
'将窗体导出为Excel代码
    DoCmd.OutputTo acOutputForm, "目标名称", acFormatXLS, , True