1

我的数据库开始遇到一些并发问题。我在办公室网络的共享位置大约有十个不同的 aacdb 文件。这些数据库之一是一种“主”数据库。它分为后端和前端。该数据库的后端包含常用表,例如用户/密码、员工、部门等。

昨天,我做了两个数据库,纯粹是为了输入。它们每个都有一个以“数据输入”模式绑定到表的表单,记录锁定设置为“已编辑记录”。它们还链接到其他数据库共享的一些相同表。这是我第一次开始遇到(可能?)并发问题。

人们一直在“主”数据库中报告奇怪的行为(表单未打开等)。这经过了一些测试,只有当用户也在链接的数据输入数据库中时才会发生。

在给定时间,所有数据库中的当前用户仍然少于十个。

下拉选择是否会锁定表格,从而阻止某些表格打开?AFAIK,仅在加载表单时查询下拉列表。

有任何想法吗?

4

1 回答 1

1

我很适合这个问题,试图让几个用户从网络共享共享同一个前端。事情只会......行不通。然后当我回去时,不可能复制失败。我决定将应用程序安装在本地机器上,但这存在版本控制问题,特别是因为我有几个不同的前端同时运行在不同的项目中。那里有更新程序,但他们要么花钱,要么我看不到代码并且不信任他们。我想出了这个作为解决方案,并且自 Access 2003 以来一直在使用它。

这是一个单独的 ACCESS 数据库,您必须像锁定任何前端一样将其锁定。

这个启动器适用于我现在正在运行的四个访问前端。您必须在网络上设置两个表。

表名:运行时间跟踪

字段:RTTID:自动编号

字段:RTTComputerName:文本

字段:RTTLoginTime:日期/时间

表名:版本控制表

字段:VCTID:自动编号

字段: VCTVersion : 数字

字段:VCTSourceLoc:文本

字段:VCTDest:文本

字段:VCTDateVer:日期/时间

RunTimeTracking 表用于防止用户在不使用启动器的情况下启动实际应用程序。当启动器运行时,它会在表中插入一个带有计算机名称的条目。当应用程序运行时,它会查找该条目,如果它没有看到它。它警告并转储。

在版本控制表中放置最新应用程序的位置,即您希望存储应用程序的本地计算机上的位置。

如果您控制的程序不止一个,则增加 VCTVersion 条目并在启动器的代码中引用它。

strSQL = "SELECT * FROM VersionControlTable WHERE VCTVersion = 200"

当启动器运行时,它会检查本地文件上的创建日期戳到网络上的文件,如果它们不同,它会复制。如果没有,它会运行。

      Private Sub Form_Load()

        DoCmd.ShowToolbar "Ribbon", acToolbarNo
        DoCmd.ShowToolbar "Status Bar", acToolbarNo


        DoCmd.Maximize


        Form.TimerInterval = 2000


    End Sub




    Private Sub Form_Timer()

        runDataCheck

    End Sub
Private Sub runDataCheck()


' This is the launcher program. This program is designed to check for
' Version information and upload and download the new version automaticaly.

' Place entry into the Run Time Tracking Table. This will be used by the Main Application to verify that
' The application was launched by the Launcher and not run straight from the desktop

'First, retrieve the name of the computer from the Environment.

Dim strCompName As String

strCompName = Environ("computername")


' Now, delete all entries on the tracking table that have this computer name associated with it.
' Later we will try to add a trigger that archives the logins.
Dim strSQL As String

strSQL = "DELETE FROM RunTimeTracking WHERE RTTComputerName = '" & strCompName & "'"


adoSQLexec (strSQL)


' Now, add and entry into the table
strSQL = "INSERT INTO RunTimeTracking (RTTComputerName,RTTLoginTime) VALUES ('" & strCompName & "','" & Now() & "')"
adoSQLexec (strSQL)

' First, retrieve the parameters from the Version Control File and put them into variables that we can use.
Dim strSource As String
Dim strDest As String
Dim dateVer As Date
Dim rs As New ADODB.Recordset

'LBLSplashLabel.Caption = "Checking Version Information...."

strSQL = "SELECT * FROM VersionControlTable WHERE VCTVersion = 200"



     With rs

        rs.Open strSQL, CurrentProject.Connection

     End With

strSource = rs.Fields("VCTSourceLoc").Value
strDest = rs.Fields("VCTDest").Value
dateVer = rs.Fields("VCTDateVer").Value



Set rs = Nothing

' Next. See if the folders on both the local drive and the source drive exists.
Dim binLocal As Boolean
Dim binNet As Boolean
Dim binDirectoryLocal As Boolean

'Debug.Print strSource
' First check to see if the network file exists.
binNet = FileExists(strSource)

If binNet = False Then

    MsgBox ("The network source files are missing. Please contact Maintenance!")
    Application.Quit (acQuitSaveNone)


End If


' Get the timestamp from the network version since it exists.
Dim fileNet As File

Dim fileLocal As File

Dim fileNetObject As New FileSystemObject

Set fileNet = fileNetObject.GetFile(strSource)

Debug.Print strSource

Debug.Print "Created Date : " & fileNet.DateCreated

Dim strDirName As String
Dim intFind As Integer



' Check to see if the Local file Exists.

binLocal = FileExists(strDest)

If binLocal = False Then
    'There is no local file.  Check to see if the directory exists

    ' Get the directory name
    intFind = (InStrRev(strDest, "\", , vbTextCompare))
    strDirName = (Left(strDest, intFind - 1))


    Debug.Print "Directory Name: " & strDirName


     binDirectoryLocal = FolderExists(strDirName)

     If binDirectoryLocal = False Then
        'There is no local directory. Create one
        MkDir (strDirName)

'        LBLSplashLabel.Caption = "Copying Files...."

        'Copy the source file to the directory.
        FileCopy strSource, strDest

        'Since we have no copied the latest version over, no need to continue. Open the main app

    OpenMaintApp (strDest)


     Else
        ' No need to create the directory, simply copy the file.
        'Copy the source file to the directory.
'         LBLSplashLabel.Caption = "Copying Files...."
         FileCopy strSource, strDest

         'Since we have no copied the latest version over, no need to continue. Open the main app

    OpenMaintApp (strDest)


     End If
End If

'Now we know that the file is in the directory, now we need to check its version.

'Get the last modified date from the file.


Set fileLocal = fileNetObject.GetFile(strDest)

Debug.Print "Last Modified Date : " & fileLocal.DateCreated



'Do the version check

If fileLocal.DateCreated <> fileNet.DateCreated Then

'         LBLSplashLabel.Caption = "Copying Files...."
         'Copy the source file to the directory.
         FileCopy strSource, strDest

         'Since we have no copied the latest version over, no need to continue. Open the main app

    OpenMaintApp (strDest)

Else

    OpenMaintApp (strDest)
End If




    OpenMaintApp (strDest)





End Sub
Private Sub OpenMaintApp(strAppName As String)
Dim accapp As Access.Application

Set accapp = New Access.Application

accapp.OpenCurrentDatabase (strAppName)

accapp.Visible = True

DoCmd.Quit acQuitSaveNone



End Sub
于 2013-02-11T16:07:09.983 回答