Exporting Access attachments

Top  Previous  Next

When you want to extract files from Access attachment-type columns, you need to also select at least the FileData subcolumn in your query.

 

Say we have the table001 structured like this:

 

attachment01

 

containing the following data:

 

attachment02
 

The first row contains a single attachment, and the second row contains 2 attachments.

 

If we just select the table, no blob data is returned.  Instead, the files attachment column displays only the names of the attached files.

 

attachment03

 

 

All attachment-type columns contain 4 sub-columns (FileName, FileType, FileData, and FileURL).  To retrieve the uploaded files, we need to use a query to extract the items, and the query needs to contain the FileData sub-column:

 

attachment04

 

 

 

Access will now return one row for each attachment that is stored in the table.  We can now proceed to extract the attached data.  To use the filename value stored in the attachment column to name our exported files, ensure that you include the FileName subcolumn in your query, and use that column value in your naming convention e.g.

 

 

attachment05

 

The attachments will then be exported and stored using their original file names.