Access.2007.VBA.Bibl..

(John Hannent) #1
strProposedSaveName = strBackupPath & strSaveName
Debug.Print “Backup save name: “ & strProposedSaveName
strTitle = “Database backup”
strPrompt = “Save database to “ & strProposedSaveName _
& “?”
strSaveName = Nz(InputBox(prompt:=strPrompt, _
title:=strTitle, Default:=strProposedSaveName))

Deal with user canceling out of the InputBox.


If strSaveName = “” Then
GoTo ErrorHandlerExit
End If

Set rst = dbsCalling.OpenRecordset(“zstblBackupInfo”)
With rst
.AddNew
![SaveDate] = Format(Date, “d-mmm-yyyy”)
![SaveNumber] = SaveNo
.Update
.Close
End With

fso.CopyFile Source:=CurrentDb.Name, _
destination:=strSaveName

ErrorHandlerExit:
Exit Function

ErrorHandler:
MsgBox “Error No: “ & err.Number & “; Description: “ & _
err.Description
Resume ErrorHandlerExit

End Function

Back up Back End Database ....................................................................................


The BackupBackEndfunction is called from the USysRegInfo table to back up the current data-
base’s back end (if there is one) to the path selected in the Extra Options dialog:


Public Function BackupBackEnd()
‘Called from USysRegInfo

On Error GoTo ErrorHandler

Dim strBackEndDBNameAndPath As String
Dim strBackEndDBName As String
Dim strBackEndDBPath As String
Dim strFilePath As String

Creating Access Add-ins 14

Free download pdf