Forms & Reports:
Record Images: Bound Object Frame

Title: Jan's Illustrated Computer Literacy 101
Did you want: Working with Databases: Access 2007, 2010, 2013, 2016


If you want to put an image in a field in a record, the field must have the data type OLE Object. On a form or report you display the image from a record in a bound object frame. This is the only way to have an image tied to a particular record.

The bound object frame on the form or report can contain an image, spreadsheet, word processing document, or any other kind of object that is associated with a program that allows OLE (Object Linking and Embedding). In fact, each record can have a different kind of object!

Properties Dialog: Bound Object Frame

Dialog: Properties - Photograph controlThe Properties dialog for a bound object frame has different properties from those that you saw for background images and Image controls. After all, it might not be holding an image at all!

It does have Size Mode (Clip, Stretch, or Zoom) and OLE Type Allowed (Embedded, Linked, or Either).

The value for the Auto Activate property determines the method for opening the the object in its original program for editing. Sometimes you will get a whole new window and sometimes a small window right in the control. The default is to double-click the control. In the case of an image object, that program that opens will be the graphics program associated with the image's file type.
 


Where you are:
JegsWorks > Lessons > Databases

Before you start...

Project 1: Intro

Project 2: Access Basics

Project 3: Tables & Queries

Project 4: Forms & Reports Arrow: subtopic open
    Import/Export/LinkTo subtopics
    Designing Forms Arrow: subtopic open
    Icon: StepForm Wizard
    Icon: StepControls
    Icon: StepCreate Form Manually
    Icon: StepFormat Form
    Icon: StepTab Control
    Icon: StepForm View
        Images in Forms & Reports
    Icon: StepForm Images
    Icon: StepRecord Images
    Icon: StepPrintable Form
    Designing ReportsTo subtopics
    Special Forms & ReportsTo subtopics
    Summary
    Quiz
    ExercisesTo subtopics


Search  
Glossary
  
Appendix



How to Insert an Object into a Record

You can insert an object into a record in either Table Datasheet View, Form Datasheet View, or in Form View. You cannot type anything in the control!

First, select the bound object frame or the datasheet cell, then...

  • Method 1: Use the menu  Insert | Object... A dialog opens for you to create or select an object, which can be an image or spreadsheet or any other OLE object.
  • Method 2: Drag and drop the file from a My Computer window into the field (Datasheet View) or control (Form View).
  • Method 3: With the file open in the original program, copy it. Paste into the field (Datasheet View) or control (Form View).
    Sometimes you will only get a picture of what you copied and pasted. Sometimes you will get the whole document, even if you copied just part of it.

What you will see after inserting an object:

Datasheet View: OLE objects don't showDatasheet view: A datasheet does not ever show the actual image or document. In Datasheet View you will see only what type of object it is, like "Bitmap Image" or "Picture" or "Microsoft Office Excel Worksheet" or the name of the program on your computer that is associated with that file type, like "PaintShopPro 9 Image". "Package" means that Access cannot display the object.
 

Form View: The control on a form or report will show the image or document. When it can't, it shows the file name and either an icon or a bitmap approximation of the file.

OLE Object: Word documnet OLE Object: PowerPoint presentation OLE Object: Excel spreadsheet
Word document PowerPoint presentation Excel spreadsheet
OLE Object: single slide from PowerPoint presentation OLE Object: Image OLE Object: unknown type
Picture of single slide
from Copy/Paste
Image Unknown file type

Icon: TroubleProblem: Table field shows Package
Icon: TroubleProblem: Form shows file name

Form View: Image in unknown formatDatasheet View: Image in unknown formatWhat's wrong: You do not have the software installed that you need to use the file's format.

You need to install a program that allows OLE connections for that file type.
 

What to do about images that don't show:

Solution 1: Install Microsoft Photo Editor from Office 2000 or Office XP or install another graphics program that has the OLE servers. BUT, if you move the database to a different computer, THAT computer also must have such a program installed for the images to display!

Solution 2: Better - Convert your images to Windows Bitmap format (*.bmp), which Access is supposed to understand.


Icon: Step-by-Step 

Step-by-Step: Record Images

 Icon: Step-by-Step

What you will learn:

to add images to records with:
    Insert Objects dialog
    drag and drop
    copy and paste
to compact database
to compare database file sizes

Start with:  Class diskresource files, worldtravel.mdb from the previous lesson

You will add images to your Staff table records. It will be interesting to see what effect on the database's file size the images will have.

WarningWarning: File Size Increase
As you add images to records in this lesson, the database file size will increase a LOT. Be sure that the disk you are saving your database to has LOTS of empty space. I needed over 30 MB. I did a lot of experimenting with objects and images. You may need to use a copy of the file on a hard disk for this part.

Backup Database

Before adding any images or new objects, you need a copy of the database at its smallest size. Backing up the database is the easiest way to get that. Besides, you should be making backups regularly anyway.

  1. Close any open forms or tables and save if necessary.
     

  2. From the menu select  File | Back Up Database...
    The Save Backup As dialog opens.
     

  3. If necessary, navigate to your databases project4 folder on your Class disk.
     

  4. Icon: Save Save with the name worldtravel_beforerecordimages.mdb.
    The database closes. A copy is made with the name that you chose. The original database opens.
    You will see security warnings again if you saw them the first time you opened the database.
     

  5. Open a My Computer window and navigate to your Class disk to the databases project4 folder. You should see worldtravel.mdb, worldtravel_beforeimages.mdb, and worldtravel_beforerecordimages.mdb.

    My Comouter: file sizes before adding images to records

    Write down the sizes of these files. (They are almost certainly different from the illustration!) As you work, the database size increases. Compacting it reduces the size somewhat. When you do a backup, the file is automatically compacted as part of the process.

    You can leave the My Computer window open.


Insert Image in Record: OLE Dialog

You can add an image to a table directly in Table Datasheet View or in Form Datasheet View. The image won't display in the datasheet. So you will usually add an image to a record via a form. You can insert the picture as an object or drag the file from a My Computer window and drop it on the control. You will try all of these in this section!

Disclaimer: All of the images of people are from clip art collections.

  1. Button: Views - list opened to Datasheet ViewOpen the form Staff-formatted.
     
  2. Switch to Datasheet View.
     
  3. Scroll to the Photograph field. This column is blank.

    Form Datasheet View: Photograph column is blank
  4. Right click Menu: Insert ObjectClick in the first row in the Photograph column.
     
  5. Right click and select  Insert Object...
    A dialog opens.
     
  6. Dialog: New Object - Create from fileSelect the second option, Create from File.
    The initial path is to where you last choose an object.
     
  7. Click on the Browse button.
    A Browse dialog opens for you to navigate to the object that you want.
     
  8. Dialog: BrowseNavigate to where you saved the resource files.
     
  9. Select the image luisperez.bmp
     
    The icon beside the image will match the program that is associated with BMP files. In the illustration, the icon is for MS Paint.
     
  10. Click on OK.
    You are back in the previous dialog, but there is a new path in the text box.
     
    You can choose here whether you want to link to the image or if you want to display a clickable icon instead of the image itself in a form or report. (Not a good choice for a printed report!)
     
  11. Dialog: New Object - path showingClick on OK.
    The graphics program that is associated with BMP images may open. The field is an OLE Object type. Access does not know how to handle objects but relies on the original program to tell it how to display it.
     
  12. If necessary, switch to the form datasheet window.
    The datasheet shows text in the field.

    Form Datasheet: an inserted image shows only text for the kind of image that it is.Form Datasheet View: Inserted image shows text for the type of image that it isWhat text you see will depend on what graphics program is associated with the BMP file format.
     
    Form View: an image in unrecognized format shows the file name and an approximation bitmap.Form Datasheet View: 'Package' in an OLE field indicates that Access cannot display the fileIcon: TroubleProblem: You see "Package" in the datasheet
    Access does not have the correct OLE server installed. In this case, in Form View you will see the name of the file and possibly a small, poor quality bitmap of the image.
    Solution: Install a graphics program that can handle the file format and will work with OLE objects.
     
  13. Form ViewSwitch to Form View to see the image.
    Better! In this view you have a chance of noticing if you inserted the wrong image since you can easily see whose record this is. In the Form Datasheet View the person's name was out of sight to the left and you could not see the image itself or even the file name.
     

Insert Image in Record: Drag and Drop

In both Form View and Datasheet View, you can drag and drop files into OLE controls. This can be easier than going through the OLE Object dialog over and over.

  1. In the Form View of the Staff-formatted form, change to record #2, Hector Chavez.
     
  2. Click on the Photograph control to select it.
     
  3. My Compute windowOpen a My Computer window to the folder where you saved the databases resource files.
     
  4. Position the windows so that you can see the form also.
     
  5. Drag the file chavez.bmp from the My Computer window and drop it on the Photograph control.
     
    The photo appears in the control.
    There may be a noticeable delay while Access does its magic.

    Form View: image with Size Mode = ClipThe image is cut off. The default value for Size Mode is Clip, which shows only the part of the image that will fit into the control, starting from the upper left corner.
     
    We will fix this shortly.

     

  6. Leave both windows open.
     

Insert Image in Record: Copy and Paste

If you are editing an image to crop or resize, it is easy to copy the image directly from the graphics software and paste to the form control. You cannot link the image when you paste it into a control. It might not have been saved any where at all!

  1. My Computer window: gardner.bmpIn the My Computer window, double-click the file named gardner.bmp.
    MS Paint with gardner.bmpThe image opens in the program that is associated with the BMP file type.

     
    Windows Picture and Fax ViewerIcon: TroubleImage did not open in an editing program

    If you do not have a graphics program installed, then double-clicking the file will probably open the image in Windows Picture and Fax Viewer, which does not have editing tools. Click the next to last button on the right to open the picture for editing.
    Right Click Menu: Open With... graphics programAlternately, you can close the viewer window, right click on the file name and choose Open With... Then choose a program from the list.
     
  2. For MS Paint, from the menu select  Edit | Select All  and then on  Edit | Copy
    OR
    Icon: Keyboard Use the key combo CTRL + A and then CTRL + C.
    These menu commands and key combos should work in most programs. If not, investigate the menus to find commands to select the whole image and copy it.
     
  3. Form View: gardner image with Clip settingSwitch to the form.
     
  4. If necessary, click on the Photograph control to select it.
     
  5. Paste.
    Whoops. The image is cut off.
     
  6. If necessary, open the Properties dialog for the control.
    The Size Mode property shows Clip, which is exactly what Access did to your image.
     
  7. Form View: gardner image with Zoom settingChange the Size Mode to Zoom.
    Now the image shows completely. There is a strip of background showing at the bottom of the control and the quality is not quite as good. Access is not a graphics program!
     
  8. Navigate back to records 1 and 2. How did changing to Zoom affect them?
    Form View: Photo Control- Perez at Zoom Form View: Photo control with Chavez at Zoom
    The first record is not so pretty now. Access does not always do a good job of resizing. The second photo looks good. Images will look the best when the size closely matches the size of the control.
     
  9. Add images from your resource files to each of the remaining records, using the method(s) of your choice. The images are named with the last name of the staff member.
     
  10. View all of the records with Clip, Stretch, and Zoom settings.

    Icon: QuestionEvaluate:  Which setting works best for the most images? Which images will need to be revised in order to look good with your choice of Size Mode?
     

  11. Save the form Staff-formatted with your choice of Size Mode.

TipResize with a graphics program: You will get better results using a graphics program to resize the image to the correct size for your control so you can use the Clip setting. For this form you need to crop the image to a square size and then resize, if necessary, to 1.5" square. Then you can sharpen the image. 

TipCrop and Reduce Size With MS Paint:
It requires a good eye and some experimenting to use MS Paint to revise your images. MS Paint does not have a Crop tool or a Resize tool like other graphics programs.

Work around for cropping: Open the image in MS Paint. Select a section of the image using the rectangular Select tool. (Try for a square shape selection.) Copy. File | New to open a new blank canvas. Paste. If there is extra white around the image, click in the white area and drag on the tiny handles until the white vanishes at the edges of the image.

Work around for resizing: From the menu select Image | Stretch/Skew and use a percentage less than 100% for both Stretch dimensions. (Your best guess) Click on OK. This will reduce the size of the image without making it jagged. Select View | Attributes to see what size your image is now. If you don't like the size, close the Attributes dialog, Undo and try again. Save your image as a bitmap for use in Access.


Compare File Size Again

Now that you have added images to the records,  will there be any difference in the file size?

  1. Verify that all database objects are saved.
     
  2. Switch to the My Computer window (If necessary open one and navigate to your Class disk to the databases project4 folder. )
     
  3. Compare the current size of worldtravel.mdb to the size of worldtravel_beforerecordimages.mdb, which was the size of worldtravel.mdb at the beginning of this lesson. There should be a significant difference!
    My Computer window showing Class disk, databases in folder
    Note: Your file sizes are almost certainly different from mine! I did a lot more work and tinkering that you probably did.
     
  4. Switch to the Access window for worldtravel.mdb.
     
  5. From the menu select  Tools | Database Utilities | Compact and Repair database...
    The database closes, compacts, and reopens.
     
  6. Switch to the My Computer window.
     
  7. Write down the file size.
    My Computer window, showing database after compacting
    Did the World Travel database change sizes much after compacting? Probably!  How does its size now compare to the size before adding the record images? (Mine shrank to less than a third of the previous size. Your file sizes are likely to be different from mine!)