Forms & Reports:
Form Images

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


Dialog: Form Properties - Picture propertiesThe way images display is managed in the Properties dialog.

 

Picture Properties:

  • Picture: Path to the picture.
    Examples:
       Absolute path C:\Company Photos\Staff\gardner.bmp
       Relative path  ..\photos\staff\gardner.bmp
                                gardner.bmp 
       
    URL         http://jegsworks.com/photos/gardner.bmp
  • Picture Type: Embedded or Linked
  • Picture Size Mode:  Clip, Stretch, or Zoom (Examples below)
  • Picture Alignment: Top Left, Top Right, Center, Bottom Left, Bottom Right, Form Center
  • Picture Tiling: Yes or No

Not all of these properties are appropriate for all kinds of images on a form or report.

For background images and Image controls, you will see all of these properties. The Properties dialog for the whole form or report controls background images like textures and watermarks. 

For unbound object frames, you will see only Size Mode (instead of Picture Size Mode), and  OLE Type (instead of Picture Type).

For bound object frames (required for pictures in records) you will see Size Mode and OLE Type, plus OLE Type Allowed.


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



Picture Size Mode

All images have a size mode property in the Properties dialog. There are 3 modes: Clip, Stretch, Zoom.

Image: Clip Image: Stretch Image: Zoom

Clip

Shows only what will fit in the control, starting from the upper left corner of the image

Stretch

Image is stretched or shrunk to fill the space, even if that deforms the image

Zoom

Image is stretched or shrunk to fit into the space  but the proportions remain the same.

The control's Back Color shows when the image does not completely fill the control. If the Back Color is "Transparent", the form's background shows in the gaps.

Recommendations:

  • Match the control's size to the image.
    If the control is much larger than the image, Zoom may enlarge the image so much that its quality becomes poor.
  • For images in records, use Zoom if the images in different records are different sizes or if you don't know what size they might be in the future.

Icon: Step-by-Step 

Step-by-Step: Form Images

 Icon: Step-by-Step

What you will learn:

to backup database
to use Properties dialog to control image display
to add a background image
to add an image to a form in an Image control
to format an Image control
to resize header and footer sections

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

You now have two forms ready for use, plus some versions of those forms as you went along. Those forms are already formatted, so you will create a new form that will have a custom background and a form image.

Backup Database

Before adding any images or new objects, you want to see what the smallest size is for the database. 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_beforeimages.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 and worldtravel_beforeimages.mdb.

    My Computer: Class disk, databases project4 folder, file sizes

    By the way, you may see a 1 KB file worldtravel.ldb. This is a temporary file that appears only while the database is open.
     

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

    You can leave the My Computer window open.

Create New Form

Now you can create a new form that you will add a background and image to yourself.

  1. In the database worldtravel.mdb, open the Tables list in the Database Window.
     
  2. Form View: Projects autoformCreate an AutoForm for the table Projects.
    (Select the table. From New Objects button select AutoForm)
    An AutoForm is a good start for a table with just a few fields like this one.
     
  3. Dialog: Save As - Projects FormIcon: Save Save the form as Projects Form.
     

Add Background Image

The AutoForm used the Standard AutoFormat style, which does not have an image background, just a color.

  1. Form Design View: Projects FormSwitch to Form Design View.
     
  2. From the menu select  View | Form Header/Footer .
     
  3. Resize the window to show all of the form.
     
  4. Drag the bottom edge of the footer up until it vanishes.
     
  5. Dialog: Properties - Projects Form, PictureIf necessary, open the Properties dialog for the Form.
     
  6. Click on the Format tab and scroll to the Picture properties.
    These 5 properties affect the background of the form.
     
  7. Help: Picture PropertyFinding Help about properties:

    • Click in the box for the Picture property.
      (It shows the text (none).
       

    • Press the F1 key.
      A Help window opens and loads an article that explains this property.
       

    • Read this article, which explains what the property is all about and what kind of objects have the property. Parts are very technical but the Remarks section usually has helpful information.
       

    • Repeat for the other "Picture" properties: Picture Type, Picture Size Mode, and Picture Alignment, Picture Tiling.
       

  8. Click in the Picture property's box ,where it says (none).
     
  9. Dialog: Properties - PictureClick the 3 dots button Button: Ellipsis (3 dots) that appeared.
     The Insert Picture dialog appears.
     
  10. Navigate to where you saved the databases resource files.
     
  11. Form Design View: Projects Form - background centered, not tiledSelect the image wall.bmp and click on OK.
    The image appears in the center of the form, below all of the other controls.
    Dialog: Properties - the Picture properties after inserting a background imageThe Properties dialog now shows a path to the image in the Picture box and uses the default settings for the other Picture properties - Embedded, Clip mode, Center alignment, and no tiling.
     
  12. Form Design View: Projects Form - background tiledChange the Picture Tiling property to Yes and click in another property to accept the change.
     
    The background for the whole form changed to show the pattern, including the Form Header and Footer (if you could see the footer).
     

Add Image

An image may be appropriate in the Form Header, for example a company logo. You do want to think carefully, however, about how much space you want to spend on decorations. You do not want to crowd your data controls.

  1. Click the Image control button Button: Image control on the Toolbox bar.
     
  2. Move the mouse pointer over the Form Header area.
    The pointer changes to the Image shapePointer: Insert Image
     
  3. Form Design View: Projects - inserting an image, Insert Picture dialog, Properties dialog shows ImagexxClick at the upper left of the header area.
    A default size Image control appears, the header area resizes, and the Insert Picture dialog appears.
     
    The Properties dialog changes to show an image control.
     
  4. Navigate, if necessary, to where you saved the resource files.
     
  5. Form Design View: Projects, company logo in header Select worldtravel-logo.bmp
    The icon beside the file in the dialog or in a My Computer window will match the graphics program that is associated with the BMP file type.

     
  6. Click OK.

    The header area resizes again to show the image at its full size.
     

Format Image and Form Header

The image is too large and needs some more formatting to make this look good.

  1. Form Design View: Projects - header images 1 x 1Resize image with Properties: With the image selected, in the Properties dialog, change both the Width and Height to 1".
     
  2. Click in another property to accept the change.
    Whoops! The current Picture Size Mode is Clip and the Picture Alignment value is Center. These property values force the image control to show just the middle part of the image.
     
  3. Form Design View:ZoomChange the Picture Size Mode to Zoom.
    Now the whole image shows in the smaller Image control.
     
  4. Change the Special Effect property to Etched.
     
  5. Form Design View: Image resized with propertiesDrag the bottom edge of the Form Header up to the bottom edge of the image so that the Form Header section is just tall enough for your image.

    Do you see the gap between the image and the border of the control at the top and at the bottom? This is not highly annoying in this case, but in other situations it may be very noticeable. You can fix it easily enough.
     
  6. Form Design View: Image control resizedResize image by dragging: Drag the bottom edge of the image control up just one grid row and release.
     
  7. Drag the top edge of the image control down just one grid row and release.
    Now the image just fits inside the control.
     
  8. Form View: Projects - header and image resized Switch to Form View to see how this is working out.

     

    Your form may not have so much empty space at the bottom. Remember that when switching between views, the window stays the same size. When you open your form directly, the window will automatically be sized to fit the form.
     

Add Labels as Titles

Headers normally have helpful info, like a title.

  1. Icon: Design Switch to Form Design View.
     
  2. Form Design View: Header textTo the right of the image, add a label using the Label tool from the Toolbox bar. Enter as text World Travel Inc.
  3. Format the text as
       Matura MT Script Capitals
       22 pts.
       Green
    .
     
  4. Add another label below the first with the text Projects
     
  5. Format as
       Tahoma
       16 pts.
       Bold.

     
  6. Form View: ProjectsSwitch to Form View to see the results.

     

  7. Icon: Save Save the form. (Projects Form)
     
  8. Close the form.
     

Compare File Size

Now that you have added a background and an image, will there be any difference in the file size?

  1. Verify that all database objects are saved. (Closing them is a good way to do that.)
     
  2. Switch to the My Computer window. (If necessary open one and navigate to your Class disk to the databases project4 folder. )
    You should see both worldtravel.mdb and worldtravel_beforeimages.mdb.
     
  3. Compare the current size of worldtravel.mdb to the size of worldtravel_beforeimages.mdb, which was the size of worldtravel.mdb at the beginning of this lesson. There should be a significant difference!
     
  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 sizes again. You will need the numbers at the end of the next lesson.

    Did the World Travel database change sizes much after compacting? Probably. How does its size now compare to the size before adding the form images? (Your file sizes are likely to be different from mine!)
    My Computer: file sizes for database before and after adding images