T
tw
Paths are hardcoded for testing purposes only...
This code is called only if an update is needed. I have the following code
in the splash screen of an updater program. The code works perfectly on my
machine, XP. I tested it on a win98 machine and it did not work, the file
never copied, however when I steped through the code on the win98 machine,
it worked fine. I'm thinking maybe I slowed it down by stepping through it
causing it to work. But that doesn't seem right, especially because when I
didn't step through the code, the file never completed copying (unless the
quit statement stopped the copy process). So I don't know what might be
wrong. The paths are all there and identical to what is stated below.
Option Compare Database
Option Explicit
Dim strDest As String
Dim strMyDB As String
Dim strVer As String
Private Sub Form_Open(Cancel As Integer)
On Error Resume Next
Dim strPath As String
Dim strBkup As String
' Update status form to identify version being copied.
strVer = DLookup("[VersionNumber]", "tblVersionServer")
Me.lblServerVersion.Caption = "Installing version number ... " & strVer
Me.Repaint
' Load variables with correct file name-path values.
strMyDB = CurrentDb.Name
strPath = "C:\Disco\"
strDest = "C:\Disco\Disco 2 Front End.mdb"
strBkup = "C:\Disco\BackUp\Disco 2 Front End.mdb"
' Create a backup (replacing existing backup if necessary) and
' remove the target file.
If Dir(strBkup) <> "" Then Kill strBkup
FileCopy strDest, strBkup
If Dir(strDest) <> "" Then Kill strDest
End Sub
Private Sub Form_Timer()
On Error Resume Next
Dim strSource As String
Dim strMsg As String
Dim strOpenClient As String
Dim strPath As String
Dim strBkup As String
Dim strWRKGRP As String
Const q As String = """"
strPath = Left(strMyDB, InStrRev(strMyDB, "\"))
strWRKGRP = "\\loving_care\Disco Data\DiscoSecure.mdw"
' We make the assumption that the new client is in the
' same folder as this utility.
strSource = strPath & "Disco 2 Front End.mdb"
FileCopy strSource, strDest
'add the workgroup switch before calling
strDest = q & strDest & q & " /WRKGRP " & q & strWRKGRP & q
' Now that the new client file has been copied, it may
' be opened. Use the SHELL command to accomplish this.
strOpenClient = "MSAccess.exe " & strDest
Shell strOpenClient, vbNormalFocus
' Exit from this application.
DoCmd.Quit
End Sub
This code is called only if an update is needed. I have the following code
in the splash screen of an updater program. The code works perfectly on my
machine, XP. I tested it on a win98 machine and it did not work, the file
never copied, however when I steped through the code on the win98 machine,
it worked fine. I'm thinking maybe I slowed it down by stepping through it
causing it to work. But that doesn't seem right, especially because when I
didn't step through the code, the file never completed copying (unless the
quit statement stopped the copy process). So I don't know what might be
wrong. The paths are all there and identical to what is stated below.
Option Compare Database
Option Explicit
Dim strDest As String
Dim strMyDB As String
Dim strVer As String
Private Sub Form_Open(Cancel As Integer)
On Error Resume Next
Dim strPath As String
Dim strBkup As String
' Update status form to identify version being copied.
strVer = DLookup("[VersionNumber]", "tblVersionServer")
Me.lblServerVersion.Caption = "Installing version number ... " & strVer
Me.Repaint
' Load variables with correct file name-path values.
strMyDB = CurrentDb.Name
strPath = "C:\Disco\"
strDest = "C:\Disco\Disco 2 Front End.mdb"
strBkup = "C:\Disco\BackUp\Disco 2 Front End.mdb"
' Create a backup (replacing existing backup if necessary) and
' remove the target file.
If Dir(strBkup) <> "" Then Kill strBkup
FileCopy strDest, strBkup
If Dir(strDest) <> "" Then Kill strDest
End Sub
Private Sub Form_Timer()
On Error Resume Next
Dim strSource As String
Dim strMsg As String
Dim strOpenClient As String
Dim strPath As String
Dim strBkup As String
Dim strWRKGRP As String
Const q As String = """"
strPath = Left(strMyDB, InStrRev(strMyDB, "\"))
strWRKGRP = "\\loving_care\Disco Data\DiscoSecure.mdw"
' We make the assumption that the new client is in the
' same folder as this utility.
strSource = strPath & "Disco 2 Front End.mdb"
FileCopy strSource, strDest
'add the workgroup switch before calling
strDest = q & strDest & q & " /WRKGRP " & q & strWRKGRP & q
' Now that the new client file has been copied, it may
' be opened. Use the SHELL command to accomplish this.
strOpenClient = "MSAccess.exe " & strDest
Shell strOpenClient, vbNormalFocus
' Exit from this application.
DoCmd.Quit
End Sub