同一访问数据库的多个实例在一台计算机上打开 - 问题

发布于 2024-10-06 11:19:02 字数 468 浏览 4 评论 0原文

我在使用 Windows Server 2008 任务计划程序执行计划任务时,在使用 ms access 2007 accdb 时遇到问题。问题是任务计划程序打开的文件正在正确打开/关闭,但“锁定”文件 (.laccdb) 在数据库关闭后仍然可见,这表明访问数据库认为它仍然打开。每次运行新任务时,都会打开一个新的访问实例。我打开架构来显示数据库中所有用户的花名册,它显示了服务器名称/管理员帐户的 3 个重复项。以下是访问中立即窗口的示例:

COMPUTER_NAME LOGIN_NAME CONNECTED SUSPECT_STATE 服务器管理员 True Null 服务器管理员 True Null SERVER Admin True Null

我希望其他人也遇到过这个问题并且知道 1) 如何轻松关闭所有打开的访问实例以及 2) 如何防止在运行任务时发生这种情况。我在任务的“设置”选项卡下设置了“不启动新实例”,但这无关紧要,因为没有任何任务同时运行。预先感谢您的任何帮助。

I'm having issues with a ms access 2007 accdb, using Windows Server 2008 task scheduler for scheduled tasks. The problem is the file that's being opened by the task scheduler is opening/closing properly, but the 'lock' file (.laccdb) remains visible after the database is closed, which is an indicator that the access db thinks it's still open. Each time a new task runs, a new instance of access is being opened. I opened the Schema to show roster of all users in the database and it's showing 3 duplicates of the server name/Admin account. Below is an example of the immediate window in access:

COMPUTER_NAME LOGIN_NAME CONNECTED SUSPECT_STATE
SERVER Admin True Null
SERVER Admin True Null
SERVER Admin True Null

I'm hoping someone else has had this problem and knows 1) How to easily close all the open instances of access and 2) how to prevent this from occuring when running a task. I have "Do not start a new instance" set under the task's 'settings' tab, but this is irrelevant b/c none of the tasks were running simultaneously. Thanks in advance for any assistance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤者何惧 2024-10-13 11:19:02

要关闭所有打开的 Access 实例(您无法从 Access 运行此实例,因为您无法保证正在运行的实例将是您检索的最后一个引用):

Sub CloseAllAccessInstances()
    Dim acc As Access.Application

    Do
        Set acc = GetObject(, "Access.Application")

        If IsNull(acc) Then Exit Do

        acc.Quit
    Loop
End Sub

运行上述命令后,检查任务管理器。如果您看到 msaccess.exe,那么您很可能有一个循环对象引用。这将阻止 Access 关闭。有关详细信息,请参阅 http://msdn。 microsoft.com/en-us/library/aa716190(VS.60).aspx

To close all open Access instances (you can't run this from Access because you can't guarantee that the running instance will be the last reference you retrieve):

Sub CloseAllAccessInstances()
    Dim acc As Access.Application

    Do
        Set acc = GetObject(, "Access.Application")

        If IsNull(acc) Then Exit Do

        acc.Quit
    Loop
End Sub

After you run the above, check the task manager. If you see msaccess.exe, then you most likely have a circular object reference. This will prevent Access from closing. For more information, have a look at http://msdn.microsoft.com/en-us/library/aa716190(VS.60).aspx.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文