By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,453 Members | 937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,453 IT Pros & Developers. It's quick & easy.

Processing attachments

100+
P: 102
Background: Front/Back Ends: MS Access 2010/VBA

I have a field named Attachments in an access table and it has a data type of attachment. I have an unbound
form that reads the table and populates the fields.
Expand|Select|Wrap|Line Numbers
  1. With rs
  2.  
  3.      Me.frmDateTime.Value = .Fields("Datex")
  4.      typex = .Fields("Type")
  5.      Me.frmContact.Value = .Fields("Contact")
  6.      Me.frmFile.Value = .Fields("File")
  7.      Me.frmReference.Value = .Fields("Reference")
  8.      Me.frmSubject.Value = .Fields("Subject")
  9.      Me.frmNote.Value = .Fields("Note")
  10.      Me.frmDateTime2.Value = .Fields("Datex")
  11.      Me.frmAttachments.Value = .Fields("Attachments")
  12.  
  13. End With
The problem is nothing is in the Attachments field. What is wrong?

Thanks.
Mar 13 '15 #1
Share this Question
Share on Google+
1 Reply


zmbd
Expert Mod 5K+
P: 5,397
It appears that the attachment control on the form that you are attempting to use is not the correct type for the attachment field.

Here's a start from MS: Attach files and graphics to the records in your database Scroll down a ways to the section for forms.

The attachment datatype is actually a special field that creates a hidden table that links the records in the hidden table to the record in the data table. So you basically have to open a recordset on the value of the attachment field to use the information contained therein which is what the attachment control will do behind the scenes.

And the following may also prove helpful:
How to: Work With Attachments In DAO
Look at the code carefully, notice how they open the recordset on the field.

Personally I do not use the attachment field except for very special circumstances as the tend to fill up the available file space quickly and are a bit clunky to use in VBA or even Macro scripting for automation. Instead I tend to store the link to the file in a text field and pull from there when needed.

If you have a more specific question or can provide more detail about what you were expecting to happen and what is actually happening we can be of more help.
Apr 20 '15 #2

Post your reply

Sign in to post your reply or Sign up for a free account.