Add a picture or object

Microsoft Office Access 2003

You can add two types of pictures or objects: an unbound picture or object, which doesn't change from record to record, or a bound picture or object, which can be different as you move from record to record. A picture or object can also be embedded or linked.

Add a picture or object that doesn't change from record to record

In a form, report, or data access page, you can add a background picture that simulates a watermark or a picture that is displayed in an image control. You can also use an unbound object frame to add a picture or object to a form or report.

ShowAdd a background picture

  1. Open the form, report, or data access page in Design view.
  2. Do one of the following:

    ShowAdd a background picture to a form or report

    1. Double-click the form selector or the report selector to open the property sheet.
    2. In the Picture property box on the Format tab, specify the path and file name for a .bmp, .ico, .dib, .wmf, .emf, or other image file. If you've installed graphics filters for other applications, you can use any file supported by those filters. If you're not sure of the path or file name, click the Build button Button image to use the Insert Picture dialog box to locate your image.
    3. In the PictureType property box, specify whether you want the picture to be embedded or linked.
    4. After you add the picture to the form or report, you can size or clip it by clicking one of the following settings in the PictureSizeMode property box.
      Setting Description
      Clip Displays the picture at actual size. If the picture is larger than the Form window, or if it is larger than the area within the margins of the report, the image is cut off.
      Stretch Sizes the picture to fit the Form window or to fit within the margins of the report. This setting may distort the image.
      Zoom Sizes the picture to fill either the height or width of the Form window, or the height or width of the area within the margins of the report. This setting won't clip the picture or distort its proportions.
    5. If you want to change the alignment of the picture, click one of the settings in the PictureAlignment property box.

      Note  If you want to center the background picture on a form, and you want the background picture to resize when you size the window, click the Center setting. If you don't want the background picture to resize when you size the window, click the Form Center setting.

    6. If you want to repeat the picture across the background of the form, set the PictureTiling property to Yes. Tiling starts at the position that is specified for the PictureAlignment property.

      Note  Set the PictureSizeMode property to Clip if you want to tile the background picture. The background picture will not be tiled if the PictureSizeMode property is set to Zoom or Stretch.

    7. If necessary, specify which pages of the report the picture will appear on by setting the PicturePages property. The available settings are All Pages, First Page, and No Pages.

    ShowAdd a background picture to a data access page

    1. On the Format menu, point to Background, and then click Picture.
    2. In the Insert Picture dialog box, make sure that Picture Files is selected in the Files of type list, and then locate the file that you want to use for the background.

    Note   You can set the following properties in the property sheet to adjust how the background picture is displayed: BackgroundPostionX, BackgroundPositionY, and BackgroundPositionRepeat.

ShowUse an image control to add an unbound picture

  1. Open the form, report, or data access page in Design view.
  2. Click the Image tool Button image in the toolbox.
  3. On the form, report, or data access page, click where you want to place the picture.
  4. In the Insert Picture dialog box, specify in the File name box the path and file name for picture. You might need to use the Look In box to specify the drive and/or folder where the picture is located.

    If you want to link to the picture in a data access page that you will use over an intranet or the Internet, specify a URL that is a valid Web address in the File name box.

  5. Do one of the following:
    • To add the picture to a form or report, click OK.
    • To add the picture to a data access page, click Insert.
    • To link the picture in a data access page, click the arrow next to Insert, and then click Link to File.

    Microsoft Access creates an image control and displays the picture in the control.

  6. To link the picture in a form or report, make sure the control is still selected, and click Properties Button image. Then set the PictureType property for the image control to Linked.

Notes

  • When you add a picture to an image control in a form or report, Microsoft Access embeds the picture by default. If you plan to use the same picture on several forms or reports, you may want to link the picture so that it isn't stored separately in each form or report.

  • When you add a picture in a data access page, the picture is added to the supporting files that Access saves to the same location as the page. If you plan to use the same picture on several different data access pages, and you don't want the picture to be added to the supporting files several times, you want to link to the image file.

ShowCreate and embed an unbound object on a form or report

  1. Open a form or report in Design view.
  2. Click the Unbound Object Frame tool Button image in the toolbox.
  3. On the form or report, click where you want to insert the object.
  4. In the Insert Object dialog box, click Create New if it's not already selected, and then in the Object Type box, click the object type you want to create.
  5. Select the Display as Icon check box if you want the object to appear as the icon for the application used to create the object instead of as the object itself. Displaying an object as an icon can be helpful when an object contains supplementary information that doesn't have to be displayed. Displaying an object as an icon also uses significantly less disk space.
  6. Click OK. Microsoft Access creates an unbound object frame.
  7. Create the object by using the application that you chose in the Object Type box in step 4, and then do one of the following:
    • If you created the object in place, click the form outside the bound object frame.

      Note  If you click Exit on the File menu, you'll quit Microsoft Access.

    • If the object that you created opened in a separate window, click Exit on the File menu of that separate window. If you're prompted to update the document, click OK.
  8. To enable editing of the object in Form view, set the Enabled property of the unbound object frame to Yes and the Locked property to No. These properties are found on the Data tab of the form's property sheet, which can be accessed by double-clicking the form selector.

ShowEmbed an existing unbound object or part of an existing unbound object on a form or report

In a form or report, you can embed an existing object that was created in another application. You can also embed part of an existing object if the application that you're copying from has OLE support for copying part of an existing document.

  1. Open a form or report in Design view.
  2. Do one of the following:

    ShowEmbed an existing unbound object

    If the application that you're copying from supports OLE drag-and-drop editing, you can drag the file directly from My Computer or the desktop. Otherwise, do the following:

    1. Click the Unbound Object Frame tool Button image in the toolbox.
    2. On the form or report, click where you want to insert the object.
    3. In the Insert Object dialog box, click Create from File, and then specify a path to the file. If you don't know the path, click Browse.
    4. Select the Display as Icon check box if you want the object to appear as the icon for the application where the object was created instead of as the object itself. Displaying an object as an icon can be helpful when an object contains supplementary information that doesn't have to be displayed. Displaying an object as an icon also uses significantly less disk space.
    5. Click OK.

      Microsoft Access creates an unbound object frame and displays the object in the frame.

    ShowEmbed part of an existing unbound object

    If the application that you're copying from supports OLE drag-and-drop editing, you can drag selected information from that application to the Design view of a Microsoft Access form or report. When you do this, Access creates an unbound object frame and inserts the selected information in the frame. Otherwise, do the following:

    1. Open the file in the application that you used to create it, and select the information you want to insert. For example, open Microsoft Excel and select a range of cells.
    2. On the Edit menu, click Copy.
    3. Switch to Microsoft Access.
    4. In Design view of the form or report, do one of the following:
      • To embed the information, click Paste Button image on the toolbar.
      • To display the object as an icon or specify what type of object to paste as, click Paste Special on the Edit menu.

      Access creates an unbound object frame, and displays the object in the frame.

  3. To enable editing of the object in Form view, select the control, click Properties on the toolbar, and on the Data tab, set the Enabled property to Yes and the Locked property to No.

ShowCreate a link to an existing unbound object or part of an existing unbound object on a form or report

In a form or report, you can create a link to an existing object that was created in another application. You can also create a link to part of an existing object if the application that you're linking to has OLE support to do so.

  1. Open a form or report in Design view.
  2. Do one of the following:

    ShowCreate a link to an existing unbound object

    1. Click the Unbound Object Frame tool Button image in the toolbox.
    2. On the form or report, click where you want to place the object.
    3. In the Insert Object dialog box, click Create from File, and then specify a path to the file. If you don't know the path, click Browse.
    4. Select the Link check box.
    5. Select the Display as Icon check box if you want the object to appear as the icon for the application where the object was created instead of as the object itself. Displaying an object as an icon can be helpful when an object contains supplementary information that doesn't have to be displayed. Displaying an object as an icon also uses significantly less disk space.
    6. Click OK.

      Microsoft Access creates an unbound object frame and displays the object in the frame.

    ShowCreate a link to part of an existing unbound object

    1. Open the file in the application that you used to create it, and select the information you want to link to. For example, open Microsoft Excel and select a range of cells.
    2. On the Edit menu, click Copy.
    3. Leave the application open, and switch to Microsoft Access.
    4. In Design view of the form or report, click Paste Special on the Edit menu.
    5. In the Paste Special dialog box, click Paste Link, and then click the type of object to paste as in the As list.
    6. Select the Display as Icon check box if you want the object to appear as the icon for the application where the object was created instead of as the object itself. Displaying an object as an icon can be helpful when an object contains supplementary information that doesn't have to be displayed. Displaying an object as an icon also uses significantly less disk space.
    7. Click OK.

      Microsoft Access creates an unbound object frame and displays the object in the frame.

  3. To enable editing of the object in Form view, select the control, click Properties on the toolbar, and on the Data tab, set the Enabled property to Yes and the Locked property to No.

Note  When you link an object, the link is automatic by default. This means that if the object is updated outside Microsoft Access, the changes will automatically appear the next time you open the form or report. If you want to control when the data is refreshed, you can change the link from automatic to manual.

Add a picture or object that changes from record to record

You can use an image control to display a bound picture in a form, report, or data access page. To display a bound embedded or linked picture or object on a form or report, you must create a bound object frame.

ShowAdd a bound image control

  1. Do one of the following:
    • To display pictures that change from record to record without storing them in a table, create a text field to store the locations of the image files. You must store the locations of the pictures in a text field if you want to display the pictures in a data access page. You can also use a text field to store the location of pictures and then use those pictures in a form or report, but you must use Visual Basic event procedures to display the pictures.
    • To display pictures that are stored in a table, do one of the following:

      You can't display the contents of an OLE Object field or an image column in a data access page.

  2. Open the form, report, or data access page in Design view.
  3. Do one of the following:

    ShowAdd an image control to a data access page, or, in a form or report, add an image control that is bound to an OLE Object field or image column

    1. In the toolbox, click the Image tool Button image.
    2. If the field list isn't displayed, click Field List Button image on the toolbar.
    3. From the field list, drag the field that contains the pictures or the locations of the pictures to the form, report, or data access page. Place the upper-left corner of the icon where you want the upper-left corner of the image to be, and release the mouse button.

    ShowIn a form or report, add an image control that is bound to a text field containing the paths to the pictures

    1. If the field list isn't displayed, click Field List Button image on the toolbar.
    2. From the field list, drag the field that contains the locations of the pictures to the form or report.
    3. In the toolbox, click the Image tool Button image.
    4. On the form or report, click where you want to place the object.
    5. In the Insert Picture dialog box, specify the path to any picture, and then click OK. For example, you can type the path to the picture for the first record.
    6. Double-click the form selector or the report selector to open the property sheet.
    7. Click the Build button Button image next to the OnCurrent property box, and then click Code Builder in the Choose Builder dialog box.
    8. Create the following event procedure. Substitute the name of the image control on your form or report for ImageControlName and the name of the control containing the path for ImagePath.
       Private Sub Form_Current() 
       On Error Resume Next 
       Me![ImageControlName].Picture =
      						Me![ImagePath] 
       End Sub 

      Note that if you are adding the event procedure in a report, the first line of the procedure will be the following:

       Private Sub Report_Current() 
    9. On the File menu in the Visual Basic Editor, click Close and return to Microsoft Access.
    10. Click the control that is bound to the text field containing the location of the pictures, and then click Properties Button image on the toolbar to open the property sheet.
    11. Click the Build button Button image next to the AfterUpdate property box, click Code Builder in the Choose Builder dialog box, and create the following event procedure. Substitute the name of the image control on your form or report for ImageControlName and the name of the control containing the path for ImagePath.
       Private Sub ImagePath_AfterUpdate() 
       On Error Resume Next 
       Me![ImageControlName].Picture =
      						Me![ImagePath] 
       End Sub 

      This event procedure enables you to add or change a picture location in Form view.

    12. On the File menu in the Visual Basic Editor, click Close and return to Microsoft Access.

    Note   To see an example of an image control that is bound to a field containing the locations of pictures, open the Employees form in the Northwind sample database.

ShowCreate a bound object frame

  1. If you haven't already done so, create a field in a table, and set the field's data type to OLE Object in a Microsoft Access database, or to image in a Microsoft Access project.
  2. Create a form or report (or open an existing form or report) that includes the OLE Object field or image column in its record source.
  3. In form or report Design view, click Field List Button image on the toolbar to display the field list.
  4. Drag the OLE Object field or image column from the field list to the form or report.

    Microsoft Access creates a bound object frame that's bound to the OLE Object field or image column.

Note  If you've already created the control by clicking the Bound Object Frame Button image tool in the toolbox, you can bind the control to a field in an underlying record source by setting the ControlSource property for the bound object frame to the name of the field.

ShowCreate and embed a bound object on a form or datasheet

  1. Do one of the following:
  2. Move to the record in which you want to insert the object, and click the OLE Object field in a Microsoft Access database, or the image column in a Microsoft Access project.
  3. On the Insert menu, click Object.
  4. In the Insert Object dialog box, click Create New if it's not already selected, and then click the kind of object that you want to create in the Object Type box.
  5. Select the Display as Icon check box if you want the object to appear as an icon instead of the object itself. Displaying an object as an icon can be helpful when an object contains supplementary information that doesn't have to be displayed. Displaying an object as an icon also uses significantly less disk space.
  6. Click OK.
  7. Create the object by using the application that you chose in the Object Type box in step 4, and then do one of the following:
    • If you created the object in place, click the form outside the bound object frame.

      Note  If you click Exit on the File menu, you'll quit Microsoft Access.

    • If the object that you created opened in a separate window, click Exit on the File menu of that separate window. If you're prompted to update the document, click OK.
If you're in Form view, Access displays the object. If you're in Datasheet view, Access displays the name of the object, for example, "Microsoft Excel Worksheet" or "Bitmap Image." To see the object that you have inserted, you must create a bound object frame on a form or report.

If you are in a form and you need to edit the object, double-click it.

ShowEmbed an existing bound object or part of an existing bound object on a form or datasheet

In a form or datasheet, you can embed an existing object that was created in another application. You can also embed part of an existing object if the application that you're copying from has OLE support for copying part of an existing document.

  1. Do one of the following:
  2. Do one of the following:

    ShowEmbed an existing bound object

    If the application that you're copying from supports OLE drag-and-drop editing, then, instead of using the Object command, you can drag the file directly from My Computer or the desktop to the OLE Object field in a Microsoft Access database, or to the image column in a Microsoft Access project. Otherwise, do the following:

    1. Move to the record in which you want to insert the object and click the OLE Object field in a Microsoft Access database (.mdb) or the image column in a Microsoft Access project (.adp).
    2. On the Insert menu, click Object.
    3. In the Insert Object dialog box, click Create from file, and then specify a path to the file. If you don't know the path, click Browse.
    4. Select the Display as Icon check box if you want the object to appear as an icon instead of as the object itself. Displaying an object as an icon can be helpful when an object contains supplementary information that doesn't have to be displayed. Displaying an object as an icon also uses significantly less disk space.
    5. Click OK.

    ShowEmbed part of an existing bound object

    If the application that you're copying from supports OLE drag-and-drop editing, you can drag selected information from that application to the OLE Object field in a Microsoft Access database, or to the image column in a Microsoft Access project. Otherwise, do the following:

    1. Switch to the application that you used to create the object, and select the information that you want to insert. For example, open Microsoft Excel and select a range of cells.
    2. On the Edit menu, click Copy.
    3. Switch back to Access, move to the record that you want to paste the object into, and click the OLE Object field in a Microsoft Access database (.mdb) or the image column in a Microsoft Access project (.adp).
    4. Click Paste Button image on the toolbar.

      Note  If you want to display the object as an icon, or if you want to specify what type of object to paste as, click Paste Special on the Edit menu.

    If you're in Form view, Microsoft Access displays the object. If you're in Datasheet view, Access displays the name of the object, for example "Microsoft Excel Worksheet" or "Bitmap Image." To see the object, you must create a bound object frame on a form or report.

ShowCreate a link to an existing bound object or to part of an existing object on a form or datasheet

In a form or datasheet, you can create a link to an existing object that was created in another application. You can also link to part of an existing object if the application that you're linking to has OLE support to do so.

  1. Do one of the following:
  2. Do one of the following:

    ShowCreate a link to an existing bound object

    1. Move to the record in which you want to link the object, and click the OLE Object field in a Microsoft Access database, or the image column in a Microsoft Access project.
    2. On the Insert menu, click Object.
    3. In the Insert Object dialog box, click Create from File, and then specify a path to the file. If you don't know the path, click Browse.
    4. Select the Link check box.
    5. Select the Display as Icon check box if you want the object to appear as the icon for the application where the object was created instead of as the object itself. Displaying an object as an icon can be helpful when an object contains supplementary information that doesn't have to be displayed. Displaying an object as an icon also uses significantly less disk space.
    6. Click OK.

    ShowCreate a link to part of an existing bound object

    You can use this procedure if the application that you're linking to has OLE support for linking to part of an existing document.

    1. Switch to the application that you used to create the object and select the information you want to link. For example, open Microsoft Excel and select a range of cells.
    2. On the Edit menu, click Copy.
    3. Leave the application open, and switch back to Microsoft Access.
    4. Move to the record you want to paste the object into, and click the OLE Object field in a Microsoft Access database, or the image column in a Microsoft Access project.
    5. On the Edit menu, click Paste Special.
    6. In the Paste Special dialog box, click Paste Link, and then click the type of object to paste as in the As list.
    7. Select the Display as Icon check box if you want the object to appear as the icon for the application where the object was created instead of as the object itself. Displaying an object as an icon can be helpful when an object contains supplementary information that doesn't have to be displayed. Displaying an object as an icon also uses significantly less disk space.
    8. Click OK.

Notes

  • If you're in Form view, Microsoft Access displays the object. If you're in Datasheet view, Microsoft Access displays the name of the object, for example, "Microsoft Excel Worksheet" or "Bitmap Image." To see the object, you must create a bound object frame on a form or report.

  • When you link an object, the link is automatic by default. Microsoft Access automatically updates the object when you move to the field. If you want to control when the link is updated, you can change the link from automatic to manual.

Security Note Users of your database or data access page will be able to view the image paths. Make sure that the paths do not include personal information, such as your name or the name of your computer.