Access.2007.VBA.Bibl..

(John Hannent) #1
Custom folder

strBackupPath = strPath & “\”

End Select

Debug.Print “Backup path: “ & strBackupPath

Check whether the path is valid.

On Error Resume Next

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

If setup has not been done, copy zstblBackupInfo to the calling database:

strCallingDb = CurrentDb.Name
strTable = “zstblBackupInfo”
Set tdfCalling = dbsCalling.TableDefs(strTable)

If tdfCalling Is Nothing Then
Debug.Print strTable & “ not found; about to copy it”
DoCmd.CopyObject destinationdatabase:=strCallingDb, _
newname:=strTable, _
sourceobjectType:=acTable, _
sourceobjectname:=strTable
Debug.Print “Copied “ & strTable
End If

Create a proposed save name for the backup database file:

strDayPrefix = Format(Date, “mm-dd-yyyy”)
strSaveName = Left(strCurrentDB, _
Len(strCurrentDB) - intExtLength) & “ Copy “ & SaveNo _
& “, “ & strDayPrefix & strExtension

Part III Adding More Functionality to Office

Free download pdf