Access.2007.VBA.Bibl..

(John Hannent) #1
FIGURE 9.1

A main menu with a Backup button and button/textbox controls for selecting an Input Documents path
and an Output Documents path for use in the database.


The Input Documents Path and Output Documents Path buttons run procedures that create a
FileDialogobject. FileDialogobjects can be created as a File Picker, or a Folder Picker dia-
log; in this case the msoFileDialogFolderPickernamed constant is used when creating the
dialog, to make it a Folder Picker dialog:

Private Sub cmdInputDocsPath_Click()

On Error GoTo ErrorHandler

Create a FileDialog object as a Folder Picker dialog box.

Set fd = Application.FileDialog(msoFileDialogFolderPicker)
Set txt = Me![txtInputDocsPath]
strPath = GetInputDocsPath()

With fd
.title = “Browse for folder where input documents “ _
& “are stored”
.ButtonName = “Select”
.InitialView = msoFileDialogViewDetails
.InitialFileName = strPath
If .Show = -1 Then
txt.Value = CStr(fd.SelectedItems.Item(1))

Working with Files and Folders 9

Free download pdf