Access.2007.VBA.Bibl..

(John Hannent) #1
Select Case strBackupChoice

Case “1”

Same folder as back end database

strBackupPath = strBackEndDBPath

Case “2”

Backups folder under back end database folder

strBackupPath = strBackEndDBPath & “Backups\”

Case “3”

Custom folder

strBackupPath = strPath

End Select

Debug.Print “Backup path: “ & strBackupPath

On Error Resume Next

Recheck whether selected path is valid.

Set sfld = fso.GetFolder(strBackupPath)
If sfld Is Nothing Then
If strBackupChoice = “3” Then
strTitle = “Invalid path”
strPrompt = strBackupPath _
& “ is an invalid path; please select another custom
path”
MsgBox strPrompt, vbOKOnly + vbExclamation, strTitle
GoTo ErrorHandlerExit
ElseIf strBackupChoice = “2” Then

Create folder.

Set sfld = fso.CreateFolder(strBackupPath)
End If
End If

On Error GoTo ErrorHandler

Create proposed save name for backup.

strDayPrefix = Format(Date, “mm-dd-yyyy”)
strSaveName = Left(strBackEndDBName, _

Part III Adding More Functionality to Office

Free download pdf