访问报表的 docmd.output to 不会导致触发report_load或其他事件



请不要再结束我的问题-我已经包含了所需的具体行为和导致问题的代码示例

Option Compare Database
Option Explicit
Sub testreportoutputto()
'DoCmd.OpenReport "report1", acViewPreview
'Stop
' this technique does not fire the report_load event
DoCmd.OutputTo acReport, "report1", acFormatPDF, "c:tempreport.pdf", True
End Sub

Access 2016 on Premises我看过其他类似的帖子,但都不太适合我的情况。

我发布了一个docmd.openreport…它运行良好。此报告有一些关于事件的内容,如report_load、Header_format等,用于动态更改标题页等。

然而,当我做一个docmd.outputo-acreport,reportname。。。要将其直接发送到PDF,on事件不会触发。当VBA直接写入磁盘时,如何在格式化过程中获得VBA控制。我想我可以在打印预览中调出报告,并做一些发送键来保存报告,但对我来说似乎有点尴尬。

所需的行为是在发出docmd.output命令时激发Report_load过程

示例代码docmd.output to acreport, "report name", afformatpdf, "c:filelocation"

似乎只有报告加载不会触发输出-所以我可以解决这个问题-感谢

最新更新