V
VBIlliterate
I am trying to compare a version to a version on the server. If it needs to
be updated, I want the first database to close and the "updater" on the
server to open and replace the version on the user's machine.
From my intermediate window, the function checkforupdate and updateversion
both work exactly as specified.
The problem is when I try to execute CheckforUpdate from an autoexec macro
or from the onload event of my startup form, I get an error message "You
can't exit database X right now. If you're running a visual basic module that
is using OLE or DDE, you may need to interrupt the module."
If I change Docmd.quit to application.quit, of course it says
C://....access.exe cannot be found.
I know this is probably something really silly, but I've spent way more time
on it than I care to admit and am stuck. Any suggestions?
Public Function CheckForUpdate()
Dim strCurrentVersion As String
Dim strServerVersion As String
strCurrentVersion = DLookup("VersionNumber", "tblVersionNumberFE")
strServerVersion = DLookup("VersionNumber", "tblVersionNumberBE")
If strCurrentVersion < strServerVersion Then
If MsgBox("Click Okay to download the newest version!", vbOKOnly,
"Update Available!") = vbOK Then
UpdateVersion
End If
Else
DoCmd.OpenForm "frmLogin"
End If
Exit Function
End Function
Public Function UpdateVersion()
Dim commandstr As String
Dim cmdtoopen As String
commandstr = "\\ServerX\RunUpdateDatabase.mdb"
cmdtoopen = """" & SysCmd(acSysCmdAccessDir) & "Msaccess.exe"""
& " """ & commandstr & """"
Shell cmdtoopen, vbNormalFocus
DoCmd.Quit
Exit Function
End Function
be updated, I want the first database to close and the "updater" on the
server to open and replace the version on the user's machine.
From my intermediate window, the function checkforupdate and updateversion
both work exactly as specified.
The problem is when I try to execute CheckforUpdate from an autoexec macro
or from the onload event of my startup form, I get an error message "You
can't exit database X right now. If you're running a visual basic module that
is using OLE or DDE, you may need to interrupt the module."
If I change Docmd.quit to application.quit, of course it says
C://....access.exe cannot be found.
I know this is probably something really silly, but I've spent way more time
on it than I care to admit and am stuck. Any suggestions?
Public Function CheckForUpdate()
Dim strCurrentVersion As String
Dim strServerVersion As String
strCurrentVersion = DLookup("VersionNumber", "tblVersionNumberFE")
strServerVersion = DLookup("VersionNumber", "tblVersionNumberBE")
If strCurrentVersion < strServerVersion Then
If MsgBox("Click Okay to download the newest version!", vbOKOnly,
"Update Available!") = vbOK Then
UpdateVersion
End If
Else
DoCmd.OpenForm "frmLogin"
End If
Exit Function
End Function
Public Function UpdateVersion()
Dim commandstr As String
Dim cmdtoopen As String
commandstr = "\\ServerX\RunUpdateDatabase.mdb"
cmdtoopen = """" & SysCmd(acSysCmdAccessDir) & "Msaccess.exe"""
& " """ & commandstr & """"
Shell cmdtoopen, vbNormalFocus
DoCmd.Quit
Exit Function
End Function