访问应用中的自动更新



我在微软访问vba应用程序中有一个问题。我有我的项目与BE和FE文件,所以我想触发客户端当打开前端之前的应用程序打开必须检查更新,如果发现任何更新将被下载到指定的文件夹。请帮忙🙏

由于我已经有了这样做的代码,我将把它作为一个例子发布在这里。

需要一个带有单个记录的表来保存当前前端版本号,并且表单绑定到带有显示版本字段的文本框的表上。表单上的标签有已发布前端的版本号。

在收到新电脑和IT安全设置防止程序复制文件之前,这个方法一直很有效。我必须修改代码,以简单地通知用户手动复制/替换文件,打开文件夹,并中止DB文件的打开。
Private Sub Form_Load()

'Check for updates to the program on start up - if values don't match then there is a later version
If Me.tbxVersion <> Me.lblVersion.Caption Then
'because administrator opens the master development copy, only run this for non-administrator users
If DLookup("Permissions", "Users", "UserNetworkID='" & Environ("UserName") & "'") <> "admin" Then
'copy Access file
CreateObject("Scripting.FileSystemObject").CopyFile _
gstrBasePath & "ProgramInstallMaterialsDatabase.accdb", "c:", True
'allow enough time for file to completely copy before opening
Dim Start As Double
Start = Timer
While Timer < Start + 3
DoEvents
Wend
'load new version - SysCmd function gets the Access executable file path
'Shell function requires literal quote marks in the target filename string argument, apostrophe delimiters fail, hence the quadrupled quote marks
Shell SysCmd(acSysCmdAccessDir) & "MSAccess.exe " & """" & CurrentProject.FullName & """", vbNormalFocus
'close current file
DoCmd.Quit
End If
Else
'tbxVersion available only to administrator to update version number in Updates table
Me.tbxVersion.Visible = False
Call UserLogin
End If
End Sub

最新更新