Access.2007.VBA.Bibl..

(John Hannent) #1
Len(strBackEndDBName) - intExtLength) _
& “ Copy “ & BackEndSaveNo _
& “, “ & strDayPrefix & strExtension
strProposedSaveName = strBackupPath & strSaveName
Debug.Print “Backup save name: “ & strProposedSaveName
strTitle = “Database backup”
strPrompt = “Save back end 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
![BackEndSaveDate] = Format(Date, “d-mmm-yyyy”)
![BackEndSaveNumber] = BackEndSaveNo
.Update
.Close
End With

fso.CopyFile Source:=strBackEndDBNameAndPath, _
destination:=strSaveName

ErrorHandlerExit:
Exit Function

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

End Function

List Query Fields ....................................................................................................


The ListQueryFieldsfunction (called from the USysRegInfo table) lists the fields in all the
select queries in the database, using the QueryDefs collection of the DAO object model:


Public Function ListQueryFields()
‘Called from USysRegInfo

On Error Resume Next

Call CopyListObjects

Creating Access Add-ins 14

Free download pdf