如何在一段时间不活动后关闭表单 [英] How to Close a Form after a Certain Time of Inactivity

查看:97
本文介绍了如何在一段时间不活动后关闭表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在一段时间后关闭来自非活动状态。在用户停止使用数据库之后,tmer倒计时并在一定时间后关闭表单并锁定它或关闭整个应用程序。使用VBA编码可以有人帮忙吗?谢谢

How to close a from after a certain time pass inactive. After the user stop working with the database the tmer count down and after a certain time either close the form and lock it or close the whole application. using VBA coding can anyone help? thanks

推荐答案

表单有一个计时器事件。如果你每次在表单上发生任何其他事情时将计数器设置为最大值,那么允许Timer事件过程在每次运行时递减此计数器,然后如果它变为0则它可以自行关闭。
Forms have a timer event. If you were to set a counter to your maximum value every time anything else happened on the form then allow the Timer event procedure to decrement this counter every time it runs then if it ever gets to 0 it could close itself down.


检查表单的空闲时间/不活动涉及表单的Timer()事件中稍微复杂的代码以及某种机制,以确定是否已访问表单上的任何控件。我有一些示例代码说明了这一点,所以如果您感兴趣,我只需将数据库上传为附件,您可以在其中查看所有操作。如果您有任何疑问,我们很乐意为您解答。如果你有兴趣,请告诉我。
Checking for a Form''s Idle Time/Inactivity involves slightly complex Code in the Timer() Event of the Form as well as some kind of mechanism to determine if any Controls on the Form have been accessed. I have some Sample Code that illustrates this point, so if you are interested, I''ll simply upload the DB as an Attachment where you can see everything in action. Should you then have any questions, we would be glad to answer them for you. Just let me know if you are interested.


我会非常有兴趣看到ADezii,但在线程中比在附件中更多。作为一般的经验法则,几乎没有人从附件中获益,因为只有在需求很大且兴趣高的时候才会下载它们。


我希望你能得到它们我知道你在这个领域的经历令人印象深刻。如果我们都能从中受益,那就太好了: - )
I''d be pretty interested to see that ADezii, but much more so in the thread than as an attachment. As a general rule of thumb, almost no-one benefits from attachments as they are only ever downloaded if the need is great and the interest high.

I was hoping you''d get involved in this thread as I know your experience in this area is impressive. It would be great if we could all benefit from it :-)


这篇关于如何在一段时间不活动后关闭表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆