Introduction
Access 2007 provides a way to store attachments as a field in a table, but you cannot access these with the OLE DB provider and therefore, you cannot access these with the Database Connectivity Toolkit. However, you can use a .NET interop library that gets installed with Access 2007 to read from an Access 2007 database and read an attachment field.
Steps to Complete
Read from the attachment field, save the file to disk, then use the System Exec VI to open the file.
Additional Notes
Access 2007 is required. The VI is saved in LabVIEW 2009 format.
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
Hi EricB
I'm tring to create a table having a field that is "attachment" data type by LabVIEW2009.
I am so happy to see your example "OpenAttachmentFromAccess2007_lv09.vi". Is there any solution or example using "Microsoft.Office.Interop.Access.DAO(12.0.0.0)" to create a table with a attachment typed field?
Thank you for your help.
HJ Lai
HJ,
I don't have an example for creating a table, but the reference for the DAO for Access (http://msdn.microsoft.com/en-us/library/ee291983%28v=office.12%29.aspx) would be a good place to start. You would use the database reference from the OpenDatabase Invoke Node to call CreateTableDef. Then, with the TableDef reference, you would add your columns, and I assume you'd be able to add an attachment type field.
Hope this helps.
-Eric
Hi Eric
Thank you for your help. I have saw DAO, ADO, ADOX related information for several days, but I still can't create an attachment typed field for a table in Access 2007. Could you please help me to point out what's wrong in my .vi as the attached image? I got error in CreateTableDef. And what I need to do in Fields-Append-"Object" ? Thank you.
Eric:
It's been years since your post, so I don't know if you're still out there, but here goes. In a situation where there are multiple documents attached in the same field, how do you choose from them? Is there a way to extract a list, then choose the nth item, for instance?