The challenge
There are times when you would like to have stored documents attached to records in your database. For example, perhaps you create invoices in an Access database and you would like to scan copies of invoices and attach them to the invoice record in your database. Or, perhaps you manage property and you would like to attach documents related to each property or to events/activity records tied to each property. Both of those scenarios could be accomplished by having embedded links to the documents in a field in your data record.
For this example, let’s assume that we are going to store invoice images tied to customer invoices. Let’s also assume that each document is a PDF file. It is also completely conceivable to print the documents with a barcoded document identifier and then use a scanner with OCR capability to store the documents into dynamically assigned folder structures based on key pieces of printed information on the document… But that is a whole other issue for another post.
The Solution
Access 2007/2010
If you are using Access 2003, the solution varies slightly from Access 2007/2010. See below for the Access 2003 solution.
To create this document link field, add a field to the table and set the type of the field be “Attachment”. Then within each data record, links to multiple files can be stored and “attached” to that record. When you click on that field, a pop-up window is displayed with a list of the linked files. You can then double-click on any file listed to open that file.
Access 2003
In Access 2003, the first step is to add a new field into your table which will contain the link to the document for each record. If more than one document is desired for a given record in the table, then you have a couple of options.
The first option is that you could add multiple document link fields (OLE Object fields) into the table structure for each record. By taking this approach then every record in your table would have the same number of potential document links. If the number of document links you desire will vary significantly from one record to another, then the second option could possibly a better approach. The first set of images shown here displays the table configuration with an OLE Object field added to the first table.
Once the OLE Object field has been added to the table, you can use the Insert Object commend from the Insert menu to insert the OLE object link. In the OLE Object Window, a “Link” checkbox appears. This link box gives you the option to insert a copy of the document into your database record or to insert a link to the document into your record. If you insert a link to the document then any future changes to the document will be reflected when the document is opened. If you insert the document then a snapshot of the current document will be retained with the data record.
The second option would be to create a sub-table (another table which would be linked back to the customer table by customer number) where the sub-table would be indexed on the customer number and its own internal record ID number. This would allow a potentially unlimited number of documents to be attached to any given customer. It would also conserve space in that customers would no documents to attach would not require any space to be assigned but customers with many links would get as much space as they need (in terms of table record space).
When you use this field in a form or in the table view directly, you will paste the path & filename of the document to be linked. In this way, if you need to retrieve the document you can simply click on the link in this field of the database to retrieve the document. **
**NOTE: If your database is used in a multi-user environment where other users have access to the same records, be sure to locate your documents somewhere that other users who could potentially need to view the document would also have security access. Other users will receive an error if they attempt to open a document that is unavailable to them for security access reasons. This location could be a shared directory on a networked PC but it could also be a shared folder on a network server or storage device. It could also be a cloud storage location such as Google Docs or Microsoft SkyDrive. In any of these locations just verify that other potential users have access permissions to the location or document where it is stored.







