Access.2007.VBA.Bibl..

(John Hannent) #1
Dim strFullDBName As String
Dim strFileName As String
Dim strFullPath() As String
Dim strDBName As String
Dim intUBound As Integer
Dim strConnect As String

Set dbsCalling = CurrentDb
Set tdfsCalling = dbsCalling.TableDefs
Set fso = CreateObject(“Scripting.FileSystemObject”)
strCurrentDB = Application.CurrentProject.Name
Debug.Print “Current db: “ & strCurrentDB
strDayPrefix = Format(Date, “mm-dd-yyyy”)
intExtPosition = InStr(strCurrentDB, “.”)
strExtension = Mid(strCurrentDB, intExtPosition)
intExtLength = Len(strExtension)
strExcludeTable = “zstblTablePrefixes”

Create backup path string depending on user choice.

strPropName = “BackupChoice”
strBackupChoice = GetProperty(strPropName, “2”)
Debug.Print “Backup choice: “ & strBackupChoice
strPropName = “BackupPath”
strPath = GetProperty(strPropName, “”)
Debug.Print “Custom backup path: “ & strPath

Check whether there are any linked tables, and exit if not.

strBackEndDBNameAndPath = “”

On Error Resume Next

Get back end database name from Connect property of a table.

For Each tdfCalling In tdfsCalling
strTable = tdfCalling.Name
Debug.Print “Table name: “ & strTable
strConnect = Nz(tdfCalling.Connect)
Debug.Print “Connect property: “ & strConnect
If strConnect <> “” Then
strBackEndDBNameAndPath = Mid(strConnect, _
InStr(strConnect, “=”) + 1)
Debug.Print “Back end db name and path: “ _
& strBackEndDBNameAndPath
GoTo ContinueBackup
End If

Next tdfCalling

On Error GoTo ErrorHandler

Part III Adding More Functionality to Office

Free download pdf