Attach files and graphics to the records in your database

Applies To
Access for Microsoft 365 Access 2024 Access 2021 Access 2019 Access 2016

You use the Attachment feature in Access to add one or more files—documents, presentations, images, and more—to records in your database. This article explains how to set up a database to use attachments and how to add and manage them.

In this article

Why should I use attachments?

You can use attachments to store several files in a single field. You can even store different types of files in that field. For example, if you own a job contacts database, you can attach one or more resumes to each contact record, plus a photo of each contact.

Attachments also store data more efficiently. Earlier versions of Access used a technology called Object Linking and Embedding (OLE) to store images and documents. By default, OLE created a bitmap version of the image or document. Those bitmap files could become very large—as much as 10 times larger than the original file. When you viewed an image or document from your database, OLE showed the bitmap image, not the original file. With attachments, you open documents and other non-image files in the apps that created them, so you can search and edit those files from Access.

In addition, OLE requires programs called OLE servers to work. For example, if you store JPEG image files in an Access database, every computer that runs that database needs another program that is registered as an OLE server for JPEG images. In contrast, Access stores attached files in their native formats, and you don't need to install extra software to view the images in your database.

Attachments and database design rules

By default, each field in a relational database contains only one piece of data. For example, if an address field contained more than one address, finding addresses would be difficult. At first glance, attachments seem to break the rules of database design because you can attach more than one file to a field. However, attachments don't break those rules. As you attach files to a record, Access creates one or more system tables and uses them behind the scenes to normalize your data. You can't view or work with those tables.

For information about viewing other system tables, see the article Use the Navigation Pane. For information about database design, see the article Database design basics.

Ways that you can use attached files

Remember these guidelines as you work with attached files:

  • You can attach files only to databases that you create in Access and that use the .accdb file format. You can't share attachments between an Access (.accdb) database and a database in the earlier .mdb file format.
  • You must create a field in a table and set that field to the Attachment data type. After you set the data type to Attachment, you can't change it.
  • You can store multiple files in a single record. For example, you can store images, and files created with word processing and spreadsheet programs.
  • You can attach a maximum of two gigabytes of data (the maximum size for an Access database). Individual files can't exceed 256 megabytes.
  • You use the Attachments dialog box to add, edit, and manage attachments. You can open the dialog box directly from the attachment field in a table by double-clicking the field. If you want to manage attachments from a form or view attachments from a report, you add the attachment control to the form or report and then bind the control to the underlying attachment table field.
  • By default, the attachment control renders images and displays the program icon that corresponds to other file types. For example, if you have a photo, a resume, and a Visio drawing attached to a record, the control renders the image and displays the program icons for the document and drawing as you scroll through the attachments.
  • When you open the Attachments dialog box from a table or a form, you can add, remove, edit, and save attached files. When you open the Attachments dialog box from a report, you can save the attached files only to another location.
  • Access will compress your attached files unless those files are compressed natively. For example, JPEG files are compressed by the graphics program that created them, so Access does not compress them.
  • If the program that was used to create the attached file is installed on your computer, you can open and edit the attached files in that program.
  • You can save attached files to locations on your hard drive or network. Then you can edit them and make sure that you want the changes before you save them back to your database.
  • You can manipulate attachments programmatically.

The steps in the following sections explain how to add and manage attachments.

Top of Page

Add an attachment field to a table

To use attachments in Access, you must first add an attachment field to at least one of the tables in your database. Access provides two ways to add an attachment field to a table. You can add the field in Datasheet view, or you can add it in Design view. The steps in this section explain how to use both techniques.

Add an attachment field in Datasheet view

  1. With the table open in Datasheet view, click the first available blank column. To find a blank column, look for Add New Field in the column header.
  2. On the Table Fields tab, in the Formatting group, click the arrow next to Data Type, and then click Attachment. Access sets the data type for the field to Attachment and places an icon in the field header. The following figure shows a new Attachment field. Notice the paperclip icon in the field header. By default, you can't enter text in the header row of Attachment fields. A new table field set to the Attachment data type
  3. Save your changes. Remember that you cannot convert the new field to another data type, but you can delete the field if you think you made an error.

Add an attachment field in Design view

  1. In the Navigation Pane, right-click the table that you want to change, and then click Design View on the shortcut menu.
  2. In the Field Name column, select a blank row and enter a name for your attachment field.
  3. In the same row, under Data Type, click Attachment.
  4. Save your changes. Remember that you can't convert the new field to another data type, but you can delete the field if you think you made an error.
  5. On the Design tab, in the Views group, click the arrow under View, and then click Datasheet View to open the table. -or- Right-click the document tab for the table and click Datasheet View on the shortcut menu. -or- In the Navigation Pane, right-click the table and click Open on the shortcut menu.
  6. Go on to the next steps.

Top of Page

Attach files directly to tables

After you add an attachment field to a table, you can attach files to records in that table without creating a data-entry form. You can also view attachments without using a form. When you view attachments directly from tables, you must open them in the apps that created them or in an app that supports that file type. For example, if you open a Word document that is attached to a table, Word starts and displays the document. If Word isn't installed on your computer, a dialog box asks you to select an app for viewing the file.

Add an attachment to a table

  1. With the table that contains your attachment field open in Datasheet view, double-click the attachment field. The Attachments dialog box appears. The following figure shows the dialog box. Attachments dialog box in Access displaying two BMP files.
  2. Click Add. The Choose File dialog box appears.
  3. Use the Look in list to navigate to the file or files that you want to attach to the record, select the file or files, and then click Open. You can select multiple files of any supported data type. For a list of supported data types, see Attachments reference later in this article.
  4. In the Attachments dialog box, click OK to add the files to your table. Access adds the files to the field and increments the number that indicates attachments accordingly. The following figure shows a field with two images attached: An Attachment field with two pieces of data
  5. Repeat these steps as needed to add files to the current field or other fields in your table.

Open the attached files from a table

  1. With the table open in Datasheet view, double-click the cell in the attachment field.
  2. In the Attachments dialog box, double-click the file that you want to open. –or– Select the file and click Open. The app associated with the file starts and opens the attached file. For example, Excel files open in Excel. Some image files may open in Microsoft Windows Picture. If you want to do more than view the image, you can right-click the image and then click Edit. This starts the app that was used to create the file, if that app is installed on your computer.

Save changes to an attached file

  1. As needed, use the app that created the file to edit it.

  2. Save any changes to the file and close the app. Keep in mind that when you change an attached file, Access saves your changes to the Temporary Internet Files folder on your hard drive. See the note at the end of this section for more information about that folder.

  3. To save your changes permanently, return to Access and, in the Attachments dialog box, click OK. A message similar to the following appears: Save attachment confirmation message box with Yes and No buttons.

  4. Click Yes to save your changes.

    Note

    When you open an attached file in its parent program for viewing or editing, Access places a temporary copy of the file in a temporary folder. If you change the file and save your changes from within the parent program, Access saves your changes to the temporary copy. When you return to Access and click OK to close the Attachments dialog box, Access prompts you to save the attached file again. Click Yes to write the changed file to your database, or click No to leave the file untouched in your database.

Top of Page

Use attachments with forms and reports

When you want to use attachments with a form or report, use the attachment control. The control renders image files automatically as you move through records in a database. If you attach other file types, such as documents or drawings, the attachment control displays the icon that corresponds to the file type. For example, you see the PowerPoint icon when you attach a presentation. The control also lets you browse attached files and open the Attachments dialog box. If you open the dialog box from a form, you can add, remove, edit, and save attachments. If you open it from a report, you can only save attachments to your hard drive or a network location because reports are read-only by design.

The steps in the following sections explain how to add an image control to a form or report, and how to scroll through records, attach files, and view your attachments. Remember that you can scroll through attachments only when a given record contains more than one attachment.

Add the attachment control to a form or report

The steps in this section explain how to add the attachment control to a form or report, and then bind the control to an Attachment field in an underlying table. You follow the same steps when adding the attachment control to a form or a report. Before you start, remember that at least one of the tables in your database must have an attachment field. For information on adding an attachment field, see Add an attachment field to a table earlier in this article.

Because form and report design can be complex processes, the steps in these sections assume that you already have a database with at least one table and one form or report. For information on creating tables, forms, or reports, see the following articles:

Add the attachment control

  1. In the Navigation Pane, right-click the form or report that you want to change and click Design View on the shortcut menu.
  2. On the Design tab, in the Tools group, click Add Existing Fields. The Field List pane appears and lists the fields in the table that provide the data for the form or report. The list denotes an attachment field by making it expandable (that is, you can click the plus or minus sign next to the field). The following figure shows a typical attachment field in the Field List pane. An Attachment field in the Field List task pane
  3. Drag the entire attachment field from the list to your form — the parent and child items — and drop it in the location that you want on your form. Access places an attachment control on your form and binds the control to the table field for you.
  4. As needed, right-click the control and click Properties to display the property sheet for the control. Set or change the control properties to match the rest of your form or report.
  5. Save your changes, and then right-click the document tab and click either Form View or Report View to open the form or report for viewing. If the underlying field contains image files, the control renders those files. If the field contains another type of file, such as a Word document or PowerPoint presentation, the control displays the appropriate icon for that file type.

Manage attachments by using a form

After you add an attachment control to a form, you can add, edit, remove, and save attached files directly from that form. When a record contains multiple attachments, you can also scroll through the attached files, which you cannot do when working with a table.

Note

The person who designed the form may have made the form read-only. If that is the case, you can use the Attachments dialog box only to save attached files to your hard disk drive or a location on your network.

Attach a file

  1. Open the form that displays your attachments, and locate the record to which you want to attach a file.

  2. Select the attachment control—the control that is bound to the Attachment field. The Mini toolbar appears.

    Note

    If you added the attachment control to the datasheet section of a split form, the Mini toolbar does not appear. For more information about split forms, see the article Create a split form.

  3. Click the View Attachments button (the paperclip icon) to open the Attachments dialog box.

  4. In the dialog box, click Add. The Choose File dialog box appears.

  5. Use the Look in list to navigate to the file that you want to attach, and then click Open.

  6. Repeat steps 4 and 5 as needed to attach more files.

Scroll through the attached files

Note

The steps in this section apply to forms and reports.

  1. Open the form or report that displays your attachments.
  2. Navigate to the record that contains the attached files.
  3. Click the image control that displays the attached files. The Mini toolbar appears.
  4. Click the Back (left) or Forward (right) arrows to scroll through the attached files. If you want to know the names of the files, click the View Attachments button to open the Attachments dialog box. The names of attached files appear in the Attachments list.

Top of Page

Save attached files to other locations

The steps in this section apply to tables, forms, and reports. You can save one or all the files that are attached to a record to locations on your hard drive or network. If you choose to save all files, you can't save only some of them. To save selected files, save them one at a time.

  • Open the table, form, or report that contains your attachments, and then open the Attachments dialog box.

Open the Attachments dialog box from a table

  • Open the table in Datasheet view, and then double-click the attachment field that contains the attachment you want to save.

Open the Attachments dialog box from a form or report

  1. Open the form or report that displays your attachments.
  2. Navigate to the record that contains the attached files.
  3. Click the image control that displays the attached files. The Mini toolbar appears.
  4. Click the View Attachment button.

Save a single attachment

  1. In the Attachments dialog box, click Save As. The Save Attachment dialog box appears.
  2. Use the Save in list to navigate to the new location for your file, and then click Save.

Save all attachments

  1. In the Attachments dialog box, click Save All. The Save Attachments dialog box appears.
  2. Use the Look in list to navigate to the new location for your files, and then click Save.

Top of Page

Remove attached files

The steps in this section apply to tables and forms.

Remove an attachment

  1. Double-click the attachment field in your table to open the Attachments dialog box. –or– In your form (in either Layout view or Form view), navigate to the record that contains the attachment you want to remove, and click the View Attachment button on the Mini toolbar to open the dialog box.
  2. In the Attachments dialog box, select the file that you want to delete and click Remove.

Top of Page

Use attachments without a mouse or other pointing device

The following section explains how to use your keyboard to place focus in the Navigation Pane and open the table, form, or report that contains attached files. The steps also explain how to browse attached files and open the Attachments dialog box.

Open a table, form, or report from the Navigation Pane

  1. Press F11.

    Note

    If the Navigation Pane is closed, pressing F11 opens it and places focus in the pane. If the pane is open, pressing F11 closes it. You must press F11 again to open the pane and move focus to it.

  2. Use Up Arrow and Down Arrow to select the table, form, or report that you want to open.

  3. Press Enter to open the selected object. If you open a table, Access places the cursor in the first field in the table. If you open a form or report, Access places the focus in the first field.

View attachments from tables

  1. As needed, use the arrow keys to move the cursor to the attachment field that you want.

  2. Press Spacebar. The Attachments dialog box appears.

  3. Press Tab to move among the buttons in the dialog box and to move from the buttons to the list of attached files under Attachments.

    Note

    Records may contain more than one attachment. If you need to select an attachment from a list of two or more files, press Tab to move to the file list, and then use the arrow keys to select the file that you want. Next, press Tab to return to the buttons and select the action that you want.

  4. When you select the file and button that you want, press Enter.

  5. When you finish, press Tab, or use Up Arrow and Down Arrow to select OK, and then press Enter.

Scroll through attachments from a form or report

These steps apply only if you have a Microsoft Natural Keyboard and when a record contains more than one attachment.

  1. As needed, press Tab to move focus to the attachment control. By default, Access highlights the control and the label associated with it, if the label exists.
  2. Press the Application key. A shortcut menu appears.
  3. Press Tab, or use the arrow keys to select Forward or Back, and then press Enter.
  4. Repeat step 2 as needed to scroll among the attached files.

Open the Attachments dialog box from a form or report

These steps apply only if you have a Microsoft Natural Keyboard.

  1. As needed, press Tab to move focus to the attachment control. By default, Access highlights the control and the label associated with it, if the label exists.
  2. Press the Application key. A shortcut menu appears.
  3. Press Tab, or use the arrow keys to select View Attachments, and then press Enter. The Attachments dialog box appears.
  4. Press Tab to move among the buttons in the dialog box and to move from the buttons to the list of attached files under Attachments (Double-click to edit). Records may contain more than one attachment. If you need to select an attachment from a list of two or more files, press Tab to move to the file list, and then use the arrow keys to select the file that you want. Next, press Tab to return to the buttons and select the action that you want.
  5. When you select the file and button that you want, press Enter.
  6. When you finish, press Tab or use the arrow keys to select OK, and then press Enter.

Top of Page

Attachments reference

The following sections provide reference information about attachments, including the image and document file formats that attachments support, file-naming conventions, and some information about attaching files to records programmatically.

Supported image file formats

Access supports the following graphic file formats natively. That means the attachment control renders them without extra software.

  • BMP (Windows Bitmap)
  • RLE (Run Length Encoded Bitmap)
  • DIB (Device Independent Bitmap)
  • GIF (Graphics Interchange Format)
  • JPEG, JPG, JPE (Joint Photographic Experts Group)
  • EXIF (Exchangeable File Format)
  • PNG (Portable Network Graphics)
  • TIFF, TIF (Tagged Image File Format)
  • ICON, ICO (Icon)
  • WMF (Windows Metafile)
  • EMF (Enhanced Metafile)

Supported formats for documents and other files

As a rule, you can attach any file that was created with one of the Microsoft Office programs. You can also attach log files (.log), text files (.text, .txt), and compressed .zip files.

File-naming conventions

The names of your attached files can contain any Unicode character supported by the NTFS file system used in Microsoft Windows. In addition, file names must conform to these guidelines:

  • Names must not exceed 255 characters, including the file name extensions.
  • Names cannot contain the following characters: question marks (?), quotation marks ("), forward or backward slashes (/ \), opening or closing brackets (< >), asterisks (*), vertical bars or pipes (|), colons (:), or paragraph marks (¶).

Types of files that Access compresses

When you attach any of the following file types to a database, Access compresses them if they are not already compressed natively.

File Extension Compressed? Reason
.jpg, .jpeg No Already compressed
.gif No Already compressed
.png No Already compressed
.tif, .tiff Yes
.exif Yes
.bmp Yes
.emf Yes
.wmf Yes
.ico Yes
.zip No Already compressed
.cab No Already compressed
.docx No Already compressed
.xlsx No Already compressed
.xlsb No Already compressed
.pptx No Already compressed

Blocked file formats

Access blocks the following types of attached files. At this time, you cannot unblock any of the file types listed here.

.ade .ins .mda .scr
.adp .isp .mdb .sct
.app .its .mde .shb
.asp .js .mdt .shs
.bas .jse .mdw .tmp
.bat .ksh .mdz .url
.cer .lnk .msc .vb
.chm .mad .msi .vbe
.cmd .maf .msp .vbs
.com .mag .mst .vsmacros
.cpl .mam .ops .vss
.crt .maq .pcd .vst
.csh .mar .pif .vsw
.exe .mas .prf .ws
.fxp .mat .prg .wsc
.hlp .mau .pst .wsf
.hta .mav .reg .wsh
.inf .maw .scf

Attach files to records programmatically

Access exposes an object model and programming interfaces for attaching files to records programmatically by using Visual Basic for Applications (VBA) code. For information about attaching files programmatically, see the articles LoadFromFile and SaveToFile.

Top of Page