我们如何限制运行MS Access应用程序的多个副本 [英] How we can restrict running multiple copies of an MS Access Application

查看:85
本文介绍了我们如何限制运行MS Access应用程序的多个副本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想限制MS Access应用程序的多个实例。假设我在我的系统上打开一个ms访问应用程序,并且我的系统的其他驱动器上的同一个ms访问应用程序的副本也被选中。这两个 该应用程序同时工作
。我想限制,只运行一个应用程序。   MS Office环境不限制它或有限制的方式。我找到了relvent例程,但不幸的是它们不起作用。我首先想到的是使用Window
Hwnd,但我又完全陷入了代码中。请建议我如何限制使用VBA代码或任何其他方式。

I want to restrict the multiple instances of an MS Access application. Suppose I open a ms access application on my system and the copy of same ms access application that is on other drive of my system, is also opned. Both  the application working on same time. I want to restrict, only run one application.  MS office environment doesn't restrict it or is there a way to restrict. I found relvent routines but unluckly they don't work. The first thing that come in my mind using Window Hwnd, but again i am totaly stuck in code. Please suggest me how we can restrict using VBA code or any other way.

谢谢

accessguru.net

accessguru.net

推荐答案

您可以尝试检查是否存在锁定文件你的另一个驱动器(.ldb如果数据库是.mdb,或.laccdb,如果数据库是.accdb)。

You could try checking if a lock file is present on your other drive (.ldb if the database is .mdb, or .laccdb if the database is .accdb).

那么在启动表单的打开事件中(假设另一个驱动器是D驱动器):

So in the open event of a startup form (assuming the other drive is the D drive):

如果""" &安培; dir(" D:\YourOtherFolder \YourDatabasename.laccdb")<> ""那么

If "" & dir("D:\YourOtherFolder\YourDatabasename.laccdb") <> "" then

  &NBSP; &NBSP; msgbox"另一个驱动器上的数据库正在使用中。"

      msgbox "The database on the other drive is in use."

  &NBSP; &NBSP; docmd.Quit

      docmd.Quit

如果

这篇关于我们如何限制运行MS Access应用程序的多个副本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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