问题描述
我在MS Access中有一个报告,其中表中的基础数据不规则地变化.我希望该报告自动反映这些更改,方法是每10秒重新加载一次表单,或者该报告获得有关更改的通知并显示新数据.这可能吗?
I have a report in MS Access where the underlying data in the tables changes irregularly. I'd like the report to reflect these changes automatically, either by reloading the form say every 10 seconds or either the report gets a notification about the changes and shows the new data. Is this possible?
推荐答案
我想到的唯一方法并不优雅:
The only way I can think of doing this is not elegant:
创建一个隐藏的窗体,将其计时器间隔设置为10秒(或您需要的任何间隔).当表单的计时器事件触发时,遍历打开的报告集合,然后关闭并重新打开找到的每个表单.
Create a hidden form with it's timer interval set to 10 seconds (or whatever interval you need). When the Forms' timer event fires, iterate through the open reports collection and close and re-open each one found.
类似的东西:
Public Sub RefreshOpenReports()
Dim rpt As Report
With Reports
' Iterate over all open reports...
For Each rpt In Reports
rpt.Requery
Next
End With
End Sub
这篇关于如何在MS Access中自动重新加载报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!