MS-Access 报告显示执行时的设计视图

发布于 2024-07-07 15:09:29 字数 423 浏览 8 评论 0原文

我在 MS Access 报告中创建了一个报告,并编写了一些 VBA 代码来检索数据并以 MS-Word 格式显示报告。 但是,在运行时生成报告时,报告首先显示或闪烁报告设计视图几秒钟,然后将生成报告。

我想找到一种解决方案来避免生成报告时设计视图的闪烁。 MS-Access 或 VBA 编码是否可行? ??

我发布了我用来从访问表单代码调用访问报告的行。

DoCmd.OpenReport rst![参数], acPreview

这将生成报告,但设计屏幕在执行时会闪烁几秒钟。

并且访问报告中没有写入VBA代码。

实际运行是,我已在临时访问表中准备数据并从表中生成报告。

这里的问题是,在预览模式下启动报表时,报表的设计屏幕会显示几秒钟。 从用户方面来看,这看起来很糟糕。

I have created a report in MS Access report and write some VBA code to retrive data and show the report in MS-Word format.
But while generate the report on runtime, the report first show or flash the report design view for few seconds and the report will get generated.

I would like to find a solution to avoid this flashing of design view while generate the report. Is it possible in this MS-Access or VBA coding. ??

I am posting the lines which i used to call the access report from access form code.

DoCmd.OpenReport rst![Argument], acPreview

this will generate the report but the design screen is flashing for few seconds while execution.

And there is no VBA code has been written in the access report.

The actual running is, i have prepare the data in a temp access table and generate the report from the table.

The problem here is, while launching the report in preview mode the design screen of the report shows of some few seconds. This looks bad from the users side.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

一人独醉 2024-07-14 15:09:30

如果您尝试此代码会发生什么:

  Dim strReport As Report        
  strReport = rst!Argument
  If SysCmd(acSysCmdGetObjectState, acReport, strReport) Then
     DoCmd.Close acReport, strReport
  End If
  DoCmd.OpenReport strReport, acPreview

该代码的作用是检查报表是否已在任何视图中打开,如果是则关闭它,然后打开它。 这可确保您不在设计视图中隐藏窗口。

该代码还避免了任何可能与将值从记录集传递到 OpenReport 命令相关的 ByRef 引用问题。

What happens if you try this code:

  Dim strReport As Report        
  strReport = rst!Argument
  If SysCmd(acSysCmdGetObjectState, acReport, strReport) Then
     DoCmd.Close acReport, strReport
  End If
  DoCmd.OpenReport strReport, acPreview

What that code does is check to see if the report is already open in any view and then closes it if it is, then opens it. That insures that you're not in design view with the window hidden.

And the code also avoids any possible ByRef reference problems that might be associated with passing a value from a recordset to the OpenReport command.

悲欢浪云 2024-07-14 15:09:30

如何将报告导出到 MS-Word? 代码是什么?

您是否尝试过使用简单的报告(带有表数据源)而不是使用 VBA 代码进行同样的操作? 也许 VBA 运行时间太长,以至于它在设计模式下保持报表打开的时间足够长,足以被察觉。

How are you exporting the report to MS-Word? What's the code?

Have you tried the same thing with a simple report (with a table data source) instead of using VBA code? Maybe the VBA is taking so long to run that it's holding the Report open in design mode long enough to be perceptible.

栩栩如生 2024-07-14 15:09:30

当我从 VB6 应用程序调用 MS Access 报告时,也会发生同样的情况。 在我的例子中发生这种情况的原因是因为我设置了一个在启动时显示的表单。 如果您没有选择启动表单,则它不应该变得可见,因此不会闪烁。

让我知道这是否有帮助。

麦克风

I have the same thing happen when I call a MS Access Report from a VB6 application. The reason it happens in my case is because I have a form set to appear at startup. If you don't have a startup form selected it should not become visible, therefore no flashing.

Let me know if this helps.

Mike

你在看孤独的风景 2024-07-14 15:09:29

您似乎正在设计视图中打开报表以更改某些属性。 也许可以避免这种情况,但您需要发布打开报告的代码才能确定。

It seems you are opening the report in design view in order to change some property. It may be possible to avoid this, but you would need to post the code that opens the report to say for sure.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文