How to automatically reload a report in MS Access?

左心房为你撑大大i 提交于 2019-12-24 01:48:18

问题


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?


回答1:


The only way I can think of doing this is not elegant:

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.

Something along the lines of:

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


来源:https://stackoverflow.com/questions/264598/how-to-automatically-reload-a-report-in-ms-access

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!