Working with Attachment data type in Microsoft Access 2007
page 5 of 6
by Jayaram Krishnaswamy
Feedback
Average Rating: 
Views (Total / Last 10 Days): 53867/ 64

Programmatic access to attachments

The new control called Attachment, shown in the design view of the report in Figure 28, is a new object. You can drag and drop this control on to a design like any other control.

Figure 28

Once on the form you can use the control programmatically as shown in Figure 29. You may refer to the Attachment object as shown here where Attachment0 is an instantiation of the Attachment object. You can write code to its properties, methods and the events.

Figure 29


View Entire Article

User Comments

Title: Multiple Attachments   
Name: RH
Date: 2012-09-27 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: 2012-09-17 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: 2012-08-21 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: 2011-09-12 5:34:12 AM
Comment:
How to print attached pdf/word documents from Access 2010?
Title: Delete attachments   
Name: dafrak
Date: 2011-04-03 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: 2011-01-25 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: 2010-10-01 12:11:38 AM
Comment:
Fabulous article - have book marked you!
Title: vb.net   
Name: sathisBoy
Date: 2010-09-16 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: 2010-07-26 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: 2010-07-23 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: 2010-04-01 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: 2009-07-30 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: 2009-07-30 7:46:28 AM
Comment:
I also forgot to include my email.
khalid.amer@btinternet.com
Title: Dr.   
Name: Khalid Amer
Date: 2009-07-30 7:44:48 AM
Comment:
How can you programmatically copy one attachment from one table to another?
Title: IDIOT   
Name: ARTHUR hill
Date: 2009-07-23 2:50:41 PM
Comment:
arthurleehill@gmail.com

I forgot to include my email with last question.
Title: CPA   
Name: Arthur Hill
Date: 2009-07-23 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: 2009-07-15 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: 2009-07-15 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-2024 ASPAlliance.com  |  Page Processed at 2024-03-28 6:46:42 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search