Hi everyone, I have a piece of code that updates an access front end. It used to run just fine, but it has suddenly started causing a Run-time error '5'. I have made no changes, and I'm able to run the UpdateDbFE.cmd file manually. Can you help me pinpoint what the problem might be? My IT department doesn't seem to have any blocks in place for this, and we made specific exceptions to allow it.
Thanks in advance!
Thanks in advance!
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"
Debug.Print BatchFile
'Set the restart file name
Restart = """" & LocalFilePath & """"
'Create the batch file[/COLOR]
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[/COLOR]
Shell BatchFile
'Close the current application so batch file can execute.[/COLOR]
DoCmd.Quit
End Sub