Public Sub ManageDatabase(strFrom As String, strTo As String, strRestart As String, strDelete As String) 'http://www.btabdevelopment.com/ts/freetools
Dim ErrorName As String
ErrorName = "InstallFrontEnd_Error"
Dim ExitThisSub As String
ExitThisSub = "Exit_" & ErrorName
ProcedureError = "mdlBackupFE-BackupFrontEnd"
Call TrackUsage("mdlBackupFE-BackupFrontEnd")
If Nz(ErrHandling, -1) = -1 Then On Error GoTo ErrorName
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Dim strCmdBatch As String
' Dim notNotebook As Object
' Dim FSys As Object
Dim TestFile As String
Dim strRestartFile As String
' sets the file name of the batch file to create
TestFile = CurrentProject.Path & "\UpdateDbFE.cmd"
' sets the restart file name
strRestartFile = """" & strRestart & """"
' creates the batch file
Open TestFile For Output As #1
Print #1, "Echo Off"
Print #1, ""
Print #1, "ping 1.1.1.1 -n 1 -w 2000"
If strDelete = "" Then
Else
Print #1, "ECHO Deleting old file"
Print #1, ""
Print #1, "Del """ & strDelete & """"
End If
Print #1, ""
Print #1, "Echo Copying new file"
Print #1, "Copy /Y """ & strFrom & """ """ & strTo & """"
Print #1, ""
If strRestart = "" Then
Else
Print #1, "Echo CLICK ANY KEY TO RESTART THE ACCESS PROGRAM"
Print #1, "START /I " & """MSAccess.exe"" " & strRestartFile
End If
Close #1
'Exit Sub
' runs the batch file
Shell TestFile
'closes the current version and runs the batch file
DoCmd.Quit
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
ExitThisSub:
Exit Sub
ErrorName:
Call LogError(Err.Number, Err.Description, ProcedureError, , True)
Resume ExitThisSub
End Sub