by A.D. Tejpal
This sample db demonstrates a user friendly approach for handling attachments in Access 2K7, without invoking the dialog box for attachment management.
As the user navigates to a given record on the sample form, names of documents held by attachment type field get displayed in a list box. Simultaneously, total count of attached documents gets displayed adjacent to the attachment control.
Appropriate command buttons provide following features:
(a) Insertion of new documents:
On clicking this command button, file open dialog box gets displayed, enabling selection of one or more files, which get added to the attachment field. Simultaneously the status of list box as well as attachment counter text box gets updated.
(b) Removal of attached documents:
Based upon selection of one or more (or all) documents in the list box, the selected items get removed from the attachment field. Simultaneously the status of list box as well as attachment counter text box gets updated.
(c) Extraction of source files from attached documents:
Based upon selection of one or more documents in the list box, source files for the selected items get extracted into a temporary folder named ZZZTemp. This folder gets created if missing and is placed in the parent folder holding the db. The status of extracted documents gets displayed in a list box adjacent to the one showing attached documents.
Note: Even if the temporary folder contains large number of extracted files pertaining to various records, only those relevant to current record get displayed in the list box.
(d) Deletion of extracted files:
Based upon selection of one or more (or all) extracted files in the list box, the selected items get deleted from the temporary folder. Simultaneously the status of list box gets updated.
(e) Opening of extracted file:
Based upon selection in the list box, the extracted file gets opened in its parent application.
Version: Access 2K7 accdb File Format
You can find the sample here: http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=531