Working with Attachment data type in Microsoft Access 2007
page 1 of 6
Published: 26 Jan 2007
Abstract
Attachment data type is new in Access 2007. Using an example, this detailed tutorial shows how you may work with this data type effectively.
by Jayaram Krishnaswamy
Feedback
Average Rating: 
Views (Total / Last 10 Days): 111050/ 261

Introduction

In MS Access 2007 Microsoft has introduced a new data type called attachments. Many types of files can be stored in a column which has the attachment data type. Someone can add bitmap files, jpg files, sound files, word documents, etc. to a column without increasing the size of the database. However, these objects will be run by the appropriate executable programs for these attachments when they are called to do so. This goes even further such that you can attach multiple, different types of attachments to the same record. This allows for the storage of the information about an employee including his picture, his resume, and any other necessary information all in one column. The Access project which is now supported again in Access 2007 does not support the attachment data type since the underlying database does not.

This comprehensive tutorial shows an example of creating a table with a column which has the new data type, attachments. It also shows how you may populate the table and view the contents of the table. It goes further and shows you how to create a report based on this table and how the report can be viewed effectively to display or render its contents.


View Entire Article

User Comments

Title: Multiple Attachments   
Name: RH
Date: 9/27/2012 12:27:50 PM
Comment:
Have you figured out a method to keep a report from replicating entries for each attachment? If I have three attachments, like in this article, it creates three instances of the same information.
Title: Feedback   
Name: CH
Date: 9/17/2012 8:30:01 PM
Comment:
For some reason, not one of the screenshot pictures are displaying, missing file or directory not found.
Title: Saving Attachment links to a separate field as a hyperlink   
Name: Michael Bailey
Date: 8/21/2012 10:54:12 AM
Comment:
Is it possible to save the link data for an attachment to a separate field as a hyperlink? I am writing a stamp collection database that uses an attachment field to store and view pictures of the stamps, but I also need to be able to store the file locations of the images in a separate field as a hyperlink
Title: How to print attached pdf/word documents   
Name: Torstein Krogh
Date: 9/12/2011 5:34:12 AM
Comment:
How to print attached pdf/word documents from Access 2010?
Title: Delete attachments   
Name: dafrak
Date: 4/3/2011 9:59:44 AM
Comment:
Something like this:

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim rsPics As DAO.Recordset

Set db = DBEngine(0)(0)

Set rs = db.OpenRecordset("picsTable")

If rs.RecordCount > 0 Then
rs.Edit
Set rsPics = rs.Fields("picsFormFieldName").Value
While Not rsPics.EOF
rsPics.Delete
rsPics.MoveNext
Wend
rs.Update
End If

rs.Close
db.Close
Set db = Nothing

Cheers
Title: Delete Attachments   
Name: twl
Date: 1/25/2011 6:03:43 PM
Comment:
I have a table that stores the attachments. I used a delete query to delete all records. When I compact and repair DB the size does not shrink.

Any ideas. I need to automate the clearing of attachemnts.
Title: Feedback   
Name: ES
Date: 10/1/2010 12:11:38 AM
Comment:
Fabulous article - have book marked you!
Title: vb.net   
Name: sathisBoy
Date: 9/16/2010 12:48:58 AM
Comment:
hai,
cn i knw hw to view the attachment in vb.net??
and cn v save exe file as attachment??
Title: Eng   
Name: Qutaiba
Date: 7/26/2010 6:22:55 AM
Comment:
i have problem in access VBA code
this code:Attachment212.SetFocus
rst.Fields("pp").Value = Attachment212.AttachmentCount
i recived erorr how i fix it
Title: Working with Attachment data type in Microsoft Access 2007   
Name: LAURIE JARVIS
Date: 7/23/2010 3:24:57 PM
Comment:
I would like to know how to get the attachment file on to a form instead of a report - is this possible? l.jarvis@hotmail.com
Title: Multiple attachments only outpus one image   
Name: Chris
Date: 4/1/2010 3:32:29 PM
Comment:
I've got several images attached to a record. The report prints out a copy of the record for each image, but only displays the first image. Suggestions?
Title: Dr.   
Name: Jayaram Krishnaswamy
Date: 7/30/2009 8:13:28 AM
Comment:
Presently I do not have this product on my computer, but I will try to get back to you in a couple of days. In the mean time the best bet is to search Microsoft Office site.
Title: Dr.   
Name: Khalid Amer
Date: 7/30/2009 7:46:28 AM
Comment:
I also forgot to include my email.
khalid.amer@btinternet.com
Title: Dr.   
Name: Khalid Amer
Date: 7/30/2009 7:44:48 AM
Comment:
How can you programmatically copy one attachment from one table to another?
Title: IDIOT   
Name: ARTHUR hill
Date: 7/23/2009 2:50:41 PM
Comment:
arthurleehill@gmail.com

I forgot to include my email with last question.
Title: CPA   
Name: Arthur Hill
Date: 7/23/2009 2:49:42 PM
Comment:
Do I understand correctly that the only way to access the properties of an Attachment type field in a table record is to use a Attachment control? I want to programatically add attachments to records by iterating thru the recordset and adding an attachment, the file name of which is based on the ID field of the current record. I do not want the records displayed on the form.

Thanks for your assistance.

Arthur Hill, CPA, MBA, MCSD, MCDBA
Title: Working with Attachment data type in Microsoft Access 2007   
Name: Jayaram Krishnaswamy
Date: 7/15/2009 12:27:03 PM
Comment:
Mike,

Thanks for the kind comments. Looks like it was not all that comprehensive! It's sometime ago I wrote this and I don't have Office 2007 on my PC. It may be possible to set up a hyperlink to get the actual resume. Next time I will take a look at this.

Regards
Title: Working with Attachment data type in Microsoft Access 2007   
Name: Mike Kovatch
Date: 7/15/2009 12:12:28 PM
Comment:
Jay,
Very good and comprehensive article. Have you figured out a way to output the entire attachment as part of the report (not just the icon representing the attachment)?
As an example, let's say the report was an interview sheet that had 10 questions with blank areas to takes note depending on their response. The report would in include a copy of the applicant's actual resume. Is this possible?
- Mike

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2014 ASPAlliance.com  |  Page Processed at 11/26/2014 6:03:58 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search