Hi there,
While the codes work great in replacing user's frontend version, I noted that the UpdateDbFE.cmd file keeps staying on user's hard drive. Is that normal? I use the same update codes as follows:
While the codes work great in replacing user's frontend version, I noted that the UpdateDbFE.cmd file keeps staying on user's hard drive. Is that normal? I use the same update codes as follows:
Code:
Private Sub UpdateFrontEnd(ByVal LocalFilePath As String, _
ByVal MasterFileFolder As String)
Dim BatchFile As String
Dim MasterFilePath As String
Dim Restart As String
'Set the file name and location for the file to copy
MasterFilePath = MasterFileFolder & "\" & CurrentProject.Name
'Set the file name of the batch file to create
BatchFile = CurrentProject.Path & "\UpdateDbFE.cmd"
'Set the restart file name
Restart = """" & LocalFilePath & """"
'Create the batch file
Open BatchFile For Output As #1
Print #1, "@Echo Off"
Print #1, "ECHO Deleting old file..."
Print #1, ""
Print #1, "ping 127.0.0.1 -n 5 -w 1000 > nul"
Print #1, ""
Print #1, "Del """ & LocalFilePath & """"
Print #1, ""
Print #1, "ECHO Copying new file..."
Print #1, "Copy /Y """ & MasterFilePath & """ """ & LocalFilePath & """"
Print #1, ""
Print #1, "ECHO Starting Microsoft Access..."
Print #1, "START /I " & """MSAccess.exe"" " & Restart
Close #1
'Run the batch file
Shell BatchFile
'Close the current application so batch file can execute.
DoCmd.Quit
End Sub