Else
Debug.Print “User pressed Cancel”
End If
End With
On Error Resume Next
DoCmd.RunCommand acCmdSaveRecord
ErrorHandlerExit:
Exit Sub
ErrorHandler:
MsgBox “Error No: “ & Err.Number _
& “; Description: “ & Err.Description
Resume ErrorHandlerExit
End Sub
Private Sub cmdOutputDocsPath_Click()
On Error GoTo ErrorHandler
Create a FileDialog object as a Folder Picker dialog box.
Set fd = Application.FileDialog(msoFileDialogFolderPicker)
Set txt = Me![txtOutputDocsPath]
strPath = GetOutputDocsPath()
With fd
.title = “Browse for folder where saved documents “ _
& “should be stored”
.ButtonName = “Select”
.InitialView = msoFileDialogViewDetails
.InitialFileName = strPath
If .Show = -1 Then
txt.Value = CStr(fd.SelectedItems.Item(1))
Else
Debug.Print “User pressed Cancel”
End If
End With
On Error Resume Next
DoCmd.RunCommand acCmdSaveRecord
ErrorHandlerExit:
Exit Sub
Part II Writing VBA Code to Exchange Data between Office Components