从Windows任务计划程序启动时,MS Access宏无法退出的问题 [英] Problem with MS Access macro not exiting when started from Windows Task Scheduler

查看:96
本文介绍了从Windows任务计划程序启动时,MS Access宏无法退出的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MS Access 2003应用程序,用于将SAP HR中的电话号码转换为特定于我们的电话簿应用程序的某种格式。来自SAP的输入文件只是一个普通的制表符分隔文本文件,它链接到访问表"phoneOrig"。


有一个宏执行以下步骤:


1)执行一个功能,该功能进行转换并将转换后的数据放入不同的访问表"phoneNew"


2 )将此表导出为纯文本


3)退出


当我手动启动访问时,执行宏并退出访问,一切都很好,每当我这样做。但是当然这个工作应该由Windows任务调度程序定期完成。


从调度程序中,转换被称为:


MSAccess.exe  ; PhoneNumber.mdb / x convertNumbers


但这通常不会退出访问。一切都已完成(目标文本文件已写入)但由于访问权限未退出,源文本文件仍然通过访问保持打开状态,并且下一个写入此文件的SAP作业将失败。我们必须从taskmanager取消访问
进程。这非常令人讨厌。


很高兴接受任何解决问题的想法。


问候,Jörg


解决方案

我不使用宏。但是我建议你创建一个启动表单,并将这样的somtehing放到Form_Open事件中:

 Private Sub Form_Open(取消为整数)

fncTransformTelephoneNumbers
DoCmd.Quit acQuitSaveNone

End Sub


I have a MS Access 2003 application for converting phone numbers from SAP HR to some format specific for our phonebook application. The input file from SAP is just a plain tab separated text file which is linked to an access table "phoneOrig".

There is one macro which executes the following steps:

1) Executing a function which makes the conversion and putting the converted data into a different access table "phoneNew"

2) Exporting this table as plain text

3) Quit

When i manually start access, execute the macro and quit access, everything is fine whenever i´m doing this. But of course this job should be done regularly by the windows task scheduler.

From the scheduler, the conversion is called like:

MSAccess.exe  PhoneNumber.mdb /x convertNumbers

But this regularly doesn´t quit access. Everything is done (the target text file is written) but as access doesn´t quit, the source text file still remains opened by access and the next SAP job to write this file will fail. We do have to cancel the access process from the taskmanager. This is very annoying.

Any ideas how to solve the problems are gladly accepted.

Greetings, Jörg

解决方案

I don't use macros. But I'd recommend you to create a startup form, and put somtehing like this to Form_Open event:

Private Sub Form_Open(Cancel As Integer)

   fncTransformTelephoneNumbers
   DoCmd.Quit acQuitSaveNone

End Sub


这篇关于从Windows任务计划程序启动时,MS Access宏无法退出的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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