Access.2007.VBA.Bibl..

(John Hannent) #1
End If

NextDoc:
Next fil

Open the Contacts form to see the attachments that have been loaded.

DoCmd.OpenForm FormName:=”frmContacts”

ErrorHandlerExit:
Exit Function

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

End Function

Figure 9.20 shows the main menu of the sample database, Files and Folders.accdb, with the Load
Attachments option selected; this selection calls the LoadAttachmentsfunction.

FIGURE 9.20
The main menu, with an Attachments button with two options, for loading or saving attachments.

Saving Attachments to Files ....................................................................................


The SaveAttachmentsprocedure performs the opposite function: working with a recordset
based on tblContacts, it uses a Recordset2type recordset to iterate through the attachments

Part II Writing VBA Code to Exchange Data between Office Components

Free download pdf