计划任务运行宏 [英] Scheduled Task to Run Macros

查看:131
本文介绍了计划任务运行宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我想知道是否有另一种方法可以在预定的时间运行宏?


目前我已经设置好了Windows计划任务,但每次运行时都会打开数据库然后关闭它。但是我希望能够让数据库保持打开并且仍然运行宏。


我有以下宏:


Run_Weekly - 附加到另一个表然后删除主表并打印

Run_Monthly - 与上面相同但删除每周表

Run_Yearly - 打印年度报告和删除年度表中的数据


是否可以通过VBA完成此操作?我只是不确定我指定每周,每月和每年运行一次。


可能没有一个简单的答案,但任何帮助都会受到赞赏。


谢谢你

Hi All,

I am wondering if there is another way to run macros at a scheduled time?

Current I have setup Windows Scheduled Tasks but each time they run they open the database and then close it. But I want to be able to leave the database open and still have the macros run.

I have the following Macros:

Run_Weekly - which appends into another table and then deletes the main table and prints
Run_Monthly - which does the same as above but deletes the Weekly Table
Run_Yearly - which prints the yearly report and deletes the data in the yearly table

is it possible for this to be done via VBA? I''m just not sure who I specify to run once a week, month and year.

There might not be an easy answer but any help would appreciated.

Thank You

推荐答案

这里要明确请问,你在谈论一个全年都在运行的数据库是?一年中每周7天,每天24小时?


只是为了开始滚动,从命令行调用数据库可以帮助您从O / S调度作业。如果确实需要从正在运行的数据库中确认上述问题的答案,我们可以为您调查。肯定有办法做到这一点。
Just to be clear here Will, you''re talking about a database which is literally left running all through the year yes? 24/7 52 weeks in the year?

Just to start the ball rolling, Invoking a Database From the Command Line can help you with scheduling jobs from the O/S. If it really is required from a running database just confirm the answers to the questions above and we can look into it for you. There is certainly a way to do it.


Hey NeoPa,


理想情况下是的,我的意思是计算机将在晚上睡觉,但是如果它需要保持打开并且能够让我能够安排通过VBA运行宏,那么我可以做到这一点,我创建了一个时钟输入,时钟输出数据库,我们的客户可以自己进出。在mo windows调度程序正在进行工作,因此它设置为在18:00关闭数据库,因此宏可以运行,因为它必须打开数据库,当数据库打开时,宏似乎不能运行! br />

数据库全天候运行是个问题吗?如果你有更好的想法,我愿意接受建议:)
Hey NeoPa,

Ideally yes, I mean the computer is set to sleep in the evening, but if it needs to remain open and running for me to able to to schedule macros to run via VBA then I can do that, I have created a clock-in, clock-out database where our customers can sign themselves in and out. At the mo windows scheduler is doing the work, so its set to close the database at 18:00 so the macros can run as its has to open the database, the macros don''t seem to run when the database is open!

is it a problem for the database to run 24/7? If you have a better Idea I''m open to suggestions :)


给我一些时间来收集我的想法。当然,只要管理它的表单保持打开(这很容易确保),也可以在Access中完成调度。我建议这个表单在检测到自己(表单)被关闭时关闭数据库。这样,您将始终知道代码是否处于活动状态。或者,为了完全放心,每隔n秒就会闪现一次,以通知操作员,如果需要,所有操作都仍然有效。即使在项目重置后,表单仍然可见。让我知道这是一个问题,同时我准备解释一切应该如何运作。
Give me a few minutes to gather my thoughts. Certainly scheduling can be done from within Access too, as long as the form managing it stays open (which is easy enough to ensure). I would suggest this form close the database whenever it detects itself (the form) being closed. That way you will always know whether or not the code is active. Alternatively, for full confidence, a flash of something should occur every n seconds to notify the operator that all is still active if that''s required. Forms can stay visible even after the project has been reset. Let me know if this is an issue while I make preparations to explain how it all should work.


这篇关于计划任务运行宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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