Forms & Reports:
Images in Forms & Reports

Title: Jan's Illustrated Computer Literacy 101


A picture that you see on a form or report is either:

  • underneath as a background
     
    OR

  • part of the form/report
     
    OR

  • part of a record.
     

Form with background, static image and data control containing an image


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



Background Image:
A background image is under all of the controls and sections that make up the form or report.

Texture imageTexture:  Repeats a small image across the whole window, called tiling. This type of background is called a texture, since it is usually used to create the effect of a textured surface. (Not recommended for reports since it adds a lot of time and ink to the print job!)
 

WatermarkWatermark - largeWatermark: A single image remains in place in the background, even if the form is scrolled. For reports, a watermark appears on every page, underneath the report controls. Watermarks can be small or large. You must be careful that your watermark does not make your data hard to read, as the example shows.
 

Image on the form/report:
An image that is part of the form is the same with every record. This might be a company logo or an image of fancy text or just a decoration, as in the example below.

Image in a record:
An image that is part of a record will usually be different for each record. These might be pictures of employees or students or products or houses for sale or team logos or thumbnail images of documents. To include an image in a record your table design must have an OLE object data type field to hold it. The form or report must use a Bound Object Frame to show the image.

Example forms showing decorative image that repeats on each formExample forms showing images in records are different for each record


Image File Formats

What image file formats you can use depends on:

  • what kind of control you are putting the image into
  • what filters and OLE servers are installed
    • which depends on what kind of graphics software you have installed.

An Image control (image on form/report) will accept images in the following file formats:

  • Computer Graphics Metafile (.cgm)
  • CorelDraw (.cdr)
  • Encapsulated PostScript (.eps)
  • Graphics Interchange Format (.gif) (Transparency does not show)
  • Icon (.ico)
  • Joint Photographic Experts Group (JPEG) (.jpg)
  • Macintosh PICT (.pict)
  • Portable Network Graphics (.png)
  • Windows Bitmap (.bmp)
  • WordPerfect Graphic (.wpg)

Both an Unbound Object Frame and a Bound Object Frame will accept images only in the following file formats by default:

  • Windows Bitmap (.bmp)
  • Device-independent bitmap (.dib)

Other formats will be accepted only if you have software installed that adds OLE servers for those formats. Access does not figure out how to display these other formats. The graphics software does, so it must be installed on the same computer as the database.

Graphics editing software is the most common source for such filters and OLE servers, such as Microsoft Photo Editor, which is part of Office 2000 and Office XP but not part of Office 2003. Microsoft Picture Manager comes with Office 2003 but does not include the OLE servers for some reason.

Recommendation:

  • Use an Image control for decorative images instead of an Unbound Object Frame.
    (A bound object frame is required for images in records.)

Creating Controls for Images

  • Button: Image Image Control: (several formats available by default)
    Method 1: Click on the Image tool  Button: Image in the Toolbox bar and click or drag on the form/report. The Insert Picture dialog opens.
    Method 2: From the menu select  Insert  |  Picture.... The Insert Picture dialog opens.

     
  • Button: Unbound Object FrameUnbound Object Frame: (only GIF and DIB formats by default)
    Method 1: Click on the Unbound  Object Frame Button: Unbound Object Frame tool in the Toolbox bar and click or drag on the form/report. A dialog opens for you to create or select an object.
    Method 2: From the menu select  Insert  |  Object.... A dialog opens for you to create or select an object.
    Method 3: Drag a graphics file from a My Computer window and drop it on the form/report.
    Method 4: Copy the image from another source document or graphics editing window and paste on the form/report.
     
  • Button: Bound Object FrameBound Object Frame (only GIF and DIB formats by default)
    Required for images that are in records.
    Method 1: Click on the Bound Object Frame toolButton: Bound Object Frame and click or drag on the form/report. Then set the Control Source property in the Properties dialog to an image field from the Field List.
    Method 2: Drag a field with OLE Object data type from the Field List and drop it on the form/report

Embed or Link?

All images can be either embedded or linked:

  • Embedded -  Copied into the database.
       Advantage: Image cannot get lost!
       Disadvantage: Adds a lot to the size of the database.
  • Linked -  Access creates an internal bitmap for linked images also but will update the image if the original changes.
       Advantage: Adds somewhat less to the size of the database than embedding. If the image changes, you can update the view in Access.
       Disadvantage: If you move the database or move the image or rename the image, then Access cannot see it. You can update the links if you know where the image is. If the image was on the form or was a background and is no longer available, you will see an error message when Access opens the form. Records will show the internal bitmap that Access made. This may be of much lower quality than the image you linked.

Advanced Alternate: It is also possible to use Visual Basic code to control your images. This method results in the smallest impact on the database's file size. It has the same disadvantages as linking. This method is too advanced for these lessons. Microsoft provides directions and sample of the codeIcon: Off site.


Images and Database File Size

A few images scattered around for decoration on forms and reports will not affect the database's file size much. However, including images with each record in a table can quickly enlarge the database immensely! Access has a limit of 2 GB for the entire database.

Icon: TroubleProblem: Images increase database size
When you embed an image, the whole image is copied to the database, even if the image is displayed at a small size. Even for a linked image Access records a lot of information. The larger the image, the more data is recorded. Images taken with today's digital cameras are often several megabytes in size! That adds up quickly!!!

Solution: Resize the images before adding them to the database.

Icon: TroubleProblem: Images slow down the database
Images in records can slow down your database, especially in the formatting of reports that include these images. This is true even when the database uses code to access images outside the database.  The default formats BMP and DIB require less computing by the computer and so will slow things down the least.

Solution: Use BMP or DIB format for images.

Icon: TroubleProblem: Access refuses to accept a file format
BMP and DIP formats are the only graphics file formats that Access is guaranteed to handle. For other formats, Access must have special filters or OLE servers installed to use the images at all.

Solution 1: Convert images to BMP or DIB format.
You will have to have graphics software that can open the original image and save it as BMP or DIB. Microsoft Paint can open images in the formats GIF, JPG, JPEG, JPE, JFIF, TIF, TIFF, PNG, and ICO and can save them as BMP or DIB format images. Be aware that some file formats, like TIF, come in different specialized versions. Your graphics program may not be able to open all of the versions.

While bitmap images are much larger than many other formats, like GIF and JPG, Access must add a lot of information in order to display images that are not bitmaps. This can actually wind up increasing the database file size more than using bitmap images does!

Solution 2: Install graphics software like Microsoft Photo Editor (from Office 2000 or Office XP)  that has the filters or OLE servers needed for the graphics formats that you want to use.

BUT, if you move the database to a different computer, THAT computer also must have such a program installed for the images to display!

An Experiment in File Size with Language Arts database:

Database with: Each Image Size:

Database File Size

No images --         4,742 KB
embedded JPG images 71 KB 81,216 KB
embedded DIB images 141 KB 81,216 KB
linked BMP images 141 KB 70,604 KB

I started with the Language Arts database ready to accept images in Student records. The database's file size was 4,732 KB, after compacting and repairing. So this is the smallest size possible with the records and objects that were already in the database.

I added an embedded image to each of the 92 student records. The file size of each image in JPG format was 71 KB. After compacting and repairing the database again, the database's file size was 81,216 KB!  So the photos added 76,484 KB, even though the photos themselves added up to only 6,532 KB. That is quite a difference!

I replaced the JPG photos with embedded DIB photos. In DIB format each image's file size was 141 KB, twice as big as the JPG images. After compacting and repairing the database, the file size was 87,216 KB. That's the same size for the database, even though the photos themselves in DIB format added 12,972 KB. Access added extra information but not as much for each photo as it did for the JPG photos.

I replaced the images with linked BMP photos. Each photo was 141 KB. The database size after compacting was 70,604 KB, which is less than using embedded images but is still much larger than without any images at all.

The database will perform better with BMP or DIB images because Access has less thinking to do with those types so those formats are a better choice. You should, however, consider carefully how useful the images are at all!


More from Microsoft: Use images in your Access forms, reports, and controlsIcon: Off site