我可以通过Dropbox共享MS-Access数据库应用程序吗? [英] Can I share an MS-Access database application via Dropbox?

查看:71
本文介绍了我可以通过Dropbox共享MS-Access数据库应用程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小型的Access应用程序,只有3或4个人会使用,但是我希望他们能够从不同的位置使用它.一次只能使用一个人.他们是非营利组织,几乎没有资金.他们没有服务器,目前正在所有人之间来回共享Excel电子表格.我想到的最简单的方法是将.accdb文件上传到Dropbox帐户,并让他们从那里访问它.我知道您可以将其发布到SharePoint,但是它们只有Office的本地副本.进行Dropbox时是否有任何问题,或者有没有其他更好的建议?

I have a small Access application that only 3 or 4 people will ever use, but I want them to be able to use it from different locations. Only one person will use it at a time. They are a non-profit with little to no funding. They don't have a server and are currently sharing an Excel spreadsheet back and forth between all of them. The easiest thing I could think of doing was to upload the .accdb file to a Dropbox account and have them access it from there. I know that you can publish it to SharePoint, but all they have are local copies of Office. Are there any issues with doing the Dropbox thing or are there any better alternatives any of you could suggest?

推荐答案

我同意使用Dropbox文件夹作为共享位置可以可能工作,前提是只有一个人打开了数据库随时.如果同时有多个人打开数据库,则Dropbox同步文件时,可能会掩盖其他人的更改,或者出现同步冲突,或者可能会感到非常困惑.

I agree that using a Dropbox folder as a shared location could possibly work provided that only one person had the database open at any one time. If more than one person opened the database at the same time then when Dropbox went to sync the file it could clobber somebody else's changes, or have sync conflicts, or perhaps just get horribly confused.

如果我要尝试使用这种方法,我肯定会依靠告诉用户总是在打开数据库之前检查其他人是否正在使用数据库"或总是以独占模式打开数据库" ".相反,我将使用类似以下VBScript的启动器脚本来管理对数据库的访问.它使用第二个文件扩展名(.Available.IN_USE)指示数据库文件的状态,创建本地(未同步)副本,在Access中打开该副本,然后将更新后的文件复制回到Dropbox文件夹中.这样就可以同步了.

If I was to try using this approach I certainly would not rely on telling users to "always check if somebody else is using the database before opening it" or "always open the database in Exclusive mode". Instead, I would use a little launcher script like the following VBScript to manage access to the database. It uses a second file extension (.Available or .IN_USE) to indicate the status of the database file, makes a local (not synced) copy, opens that copy in Access, and then copies the updated file back to the Dropbox folder so it can be synced.

Option Explicit
Dim WshShell, fso, f, AccessPath, DropboxFolder, WorkingFolder, DatabaseName
Const TemporaryFolder = 2

DropboxFolder = "C:\Users\Gord\Dropbox\dbStorage\"
DatabaseName = "myDatabase.accdb"

Set fso = CreateObject("Scripting.FileSystemObject")
WorkingFolder = fso.GetSpecialFolder(TemporaryFolder) & "\"
If fso.FileExists(DropboxFolder & DatabaseName & ".Available") Then
    Set f = fso.GetFile(DropboxFolder & DatabaseName & ".Available")
    f.Name = DatabaseName & ".IN_USE"
    WScript.Echo "Copying database file to working folder..."
    f.Copy WorkingFolder & DatabaseName
    Set f = Nothing

    Set WshShell = CreateObject("WScript.Shell")
    AccessPath = WshShell.RegRead("HKEY_CLASSES_ROOT\Access.MDBFile\shell\Open\command\")
    AccessPath = Left(AccessPath, InStr(AccessPath, "MSACCESS.EXE") + 12)

    WScript.Echo "Launching Access..."
    WshShell.Run AccessPath & " """ & WorkingFolder & DatabaseName & """", 1, True

    WScript.Echo "Copying database file back to Dropbox folder..."
    fso.CopyFile WorkingFolder & DatabaseName, DropboxFolder & DatabaseName & ".IN_USE"
    Set f = fso.GetFile(DropboxFolder & DatabaseName & ".IN_USE")
    f.Name = DatabaseName & ".Available"
    Set f = Nothing
Else
    If fso.FileExists(DropboxFolder & DatabaseName & ".IN_USE") Then
        MsgBox "The database is currently in use. Try again later."
    Else
        MsgBox "The database could not be found."
    End If
End If
Set fso = Nothing

启动器可以由目标为的快捷方式调用

The launcher could be invoked by a shortcut whose target is

CSCRIPT.EXE C:\wherever\launchMyDatabase.vbs

这篇关于我可以通过Dropbox共享MS-Access数据库应用程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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