Home

Objects, Pictures, and Attachments

Pictures

Introduction

A picture is a graphical object that either is displayed on a form or report or is used as the background of a form or report. Microsoft Access supports various types (extensions) of pictures, some of them can display directly on a form or report but some others can only be represented.

An Image

Microsoft Access makes it possible and easy to display a picture on a form or a report. To take care of this, after displaying the form or report in design view, in the Controls section of the Design tab of the Ribbon, click Image Bound Object Frame and click the form or report. This will open the Insert Picture dialog box from which you can locate and select the picture.

Practical Learning: Binding an Object

  1. Start Microsoft Access
  2. In the list of databases, click Ceil Inn2
  3. In the Navigation Pane, right-click Switchboard and click Design View
  4. In the Controls section of the Ribbon, click the Image Bound Object Frame button and click the Form
  5. In the Insert Picture dialog box, locate the ceilinn.png file that comes with these lessons
  6. Click OK
  7. Position the picture in the bottom side of the form:

    Adding an Image to a Form

  8. To preview, right-click the form's title bar and click Form View

    Adding an Image to a Form

  9. Close the form
  10. When asked whether you want to save the changes, click Yes

A Logo

A logo is a picture that represents or symbolizes a company. To add a logo to a form a report, display the form or report in Design View. In the Controls section of the Ribbon, click Logo Logo. This would open the Insert Logo dialog box where you can select a picture.

Practical Learning: Adding a Logo

  1. On the Ribbon, click File and click Open
  2. In the list of files, click RoadSystem1
  3. In the Navigation Pane, right-click the Roads form and click Design View
  4. In the Header / Footer section of the Ribbon, click Logo Logo
  5. From the Insert Picture dialog box, locate the interstate.bmp file from the resources that accompany these lessons
  6. Click OK

    Adding a Logo

  7. To preview the form, in the Views section of the Ribbon, click the View button

    Adding a Logo

  8. Close the form
  9. When asked whether you want to save, click Yes

Document and Object Linking

Introduction

Object Linking and Embedding (OLE) consists of adding or positioning an object, any object, to or in another object. In a Microsoft Access database, OLE makes it possible to add an object that was created using another application. The object can be positioned on a form or report. When the user accesses the object, Microsoft Access tries to display the object directly on the form or report. If the object (itself) cannot be displayed (for any reason), Microsoft Access displays an icon. On a form, the user can double-click the object or the icon. In this case, Microsoft Access will look for a local application that can open the object.

The OLE Object Type

A bound object is one that is tied to an existing column of a table. This means that the table must have a column that can use bound objects.

To support OLE objects, Microsoft Access provides the OLE Object data type. To apply the OLE Object type to a column:

  • In the Datasheet View of a table, after specifying the column name or clicking a cell under it, in the Data Type & Formatting section of the Datasheet tab of the Ribbon, click the arrow of the Data Type combo box and select OLE Object
  • In the Design View of a table, specify the Data Type of the field as OLE Object

Practical Learning: Creating and OLE Object Field

  1. On the Ribbon, click File and click Open
  2. In the list of files, click Metro System1 from Lesson 15
  3. In the Navigation Pane, right-click the MetroLines table and click Design View
  4. Click the first empty cell under Field Name and type Description
  5. Press Tab and, in its Data Type, select OLE Object.
  6. To switch the table to the another view, right-click its title bar and click Datasheet View
  7. When asked whether you want to save, click Yes

Adding an OLE Object to a Form or Report

To use an OLE object in a field, you can work from the Datasheet View of a table or the Form View of a form. When a table has a column that is OLE Object-based, you can drag that column from the Field List and drop it on the form or report.

To add an OLE Object control to a form or report in the Design View, in the Controls section of the Ribbon, click Bound Object Frame Bound Object Frame and click the desired area of the form or report. You can then design the size and position of the frame as you see fit. Since the object is (supposed to be) bound to a field on the source table (or the source report), specify its column in the Record Source property.

Selecting an OLE Object for a Form or Report

After setting the Data Type of a field to OLE Object, to include an external object into the field, whether using the table Datasheet View or the form in Form View, right-click the field and click Insert Object. This would open the Insert Object dialog box that presents two options to create or select the object:

  • If you want to use an application installed in your computer to create the document, click the Create New radio button. Then, in the Object Type list, click the application and click OK
  • If the object has been created and resides on a portable media (floppy disk, CD, DVD, etc), on your hard drive or on the network your computer is connected to, you can click the Create From File radio button and click Browse. This would bring the Browse dialog box that allows you to locate and select the document

Practical Learning: Using OLE Objects

  1. Right-click the empty box under Description for the Blue record and click Insert Object
  2. On the Insert Object dialog box, click the Create From File radio button
  3. Click the Browse button
  4. In the Browse dialog box, from the resources that accompany these lessons, select the Blue Line.docx document
  5. In the Browse dialog box, click Open
  6. In the Insert Object dialog box, click OK
  7. Right-click the empty box under Description for the Green record and click Insert Object
  8. On the Insert Object dialog box, click the Create From File radio button
  9. Click the Browse button
  10. In the Browse dialog box, from the resources that accompany these lessons, select the Green Line.ppt document
  11. In the Browse dialog box, click Open
  12. In the Insert Object dialog box, click OK
  13. Close the table
  14. In the Navigation Pane, right-click the MetroLines form and click Design View
  15. On the form, click the Description tab to select it
  16. In the Tools section of the Ribbon, click Add Existing Fields
  17. From the Field List, drag Description and drop in the More Information tab on the form
  18. Click the accompanying label and press Delete
  19. Resize the frame to occupy most of the body of the form

    Using OLE Objects

  20. Switch the form to Form View
  21. Navigate to  the record for the Orange line
  22. Click the Description tab to select it
  23. Right-click the body of the tab and click Insert Object
  24. On the Insert Object dialog box, click the Create From File radio button
  25. Click the Browse button
  26. In the Browse dialog box, from the resources that accompany these lessons, select the Orange Line.pdf document
  27. In the Browse dialog box, click Open
  28. In the Insert Object dialog box, click OK
  29. Switch the form to Design View

Unbound Objects

Introduction

An object is said to be unbound if it is not linked to a column of a table. Microsoft Access supports all types of objects because such objects are actually embedded on the form or report. This means that an object like a picture or an icon may simply represent the object that is actually located somwhere else. Here is how it works. When you add an unbound object to a form, Microsoft Access tries to display that object. If it cannot, then it displays an icont that servers as a link that the user can click or double-click. This would launch an application that can open the object.

Using an Unbound Object

To add an unbound object, display the form or report in Design View. In the Controls section of the Ribbon, click the Unbound Object Frame button Unbound Object Frame and click the form or report. A wizard will help you select the object you want to add to your form or report. In the same way, you can add as many unbound objects as you need to a form or report.

 
 
 

The Web Browser

Introduction

A web browser is a control that shows a file. The file can be a regular picture or a web address that is identified as a Uniform Resource Locator (URL). A web browser is very flexible with the type of document it can show. Still, you must follow some rules to prepare the document.

The primary type of document intended for a browser is a webpage. You probably already know how to create such a document. A browser can also be asked to display a picture. The web browser of Microsoft Windows supports various or all types of pictures, including those with the extensions .bmp, .jpg, .jpeg, .gif, .png, etc.

A web browser can be added only to a form. To get it, after displaying the form in Design View, in the Controls section of the Design tab of the Ribbon, click the Web Browser Control Web Browser Control and click the form.

Practical Learning: Introducing the Web Browser

  1. On the Ribbon, click File and click Open
  2. In the list of files, click StatesStatistics1
  3. In the Navigation Pane, right-click the States form and click Design View
  4. On the form, click the State's Website tab (you may have to click it twice until the orange rectangle appears) to select it
  5. In the Controls section of the Ribbon, click the Web Browser Control Web Browser Control
  6. Click inside the orange rectangle in the tab on the form.
    If a wizard starts, click Cancel
  7. Enlarge and heighten the control to occupy most of the tab page

    Adding a Web Browser to a Form

  8. On the form, click the Wikipedia tab to select it
  9. In the Controls section of the Ribbon, click the Web Browser Control Web Browser Control and click inside the orange rectangle in the tab on the form.
    If a wizard starts, click Cancel
  10. Apply the same location and the same size as the other browser

Characteristics of a Web Browser

Probably the most important detail of a web browser is the document it displays. This is specified by the Record Source property. You cannot create a web browser on a table. Instead, you can create a text-based field, then use it as the record source of a browser. When performing data entry, enter the name of the file with extension, the complete path and name of the file, or the URL of the web page that the browser would display.

Practical Learning: Using a Web Browser

  1. On the form, click the State's Websize tab and click the WebBrowser on it
  2. In the Property Sheet, click Data.
    Click Control Source and set its value to StateWebsite
  3. On the form, click the Wikipedia tab and click the WebBrowser on it
  4. In the Data tab of the Property Sheet, set the Control Source to Wikipedia
  5. To preview the form, right-click its tab and click Form View

    Web Browser

    Web Browser

    Web Browser

    Web Browser

  6. Close the form
  7. When asked whether you want to save, click Yes

Web Browser Events

The web browser has many events appropriate for its functionality:

The Events of a Web Browser

We already know that you can submit the path of a file or a URL to it. When a file path or a URL is given to a web browser, before it processes it, the control fires an event named On Before Navigate. If there is no problem in this event, the control shows the file or the web page. When the control has finished displaying the document, the web browser fires the On Document Complete event. If there is a change on the document, the control fires an On Progress Change event.

When a web browser has received a file path or a URL, it makes an attempt to show that file or the web page. If it encounters a problem, it fires an On Navigation Error event.

At any time, and if you allow it, the user can change the document the control is displaying. When a new document must be displayed, the control fires an On Updated event.

Attachments

Introduction

The OLE Object provides a convenient means of adding an external file to a record. One of the problems with it is that it can add only one object. Sometimes you want to associate many documents to one record and you may have a different number of objects for different records. Microsoft Access solves this problem through an attachment. An attachment is a technique of associating one or more files to a record.

Practical Learning: Introducing Attachment Fields

  1. On the Ribbon, click File and click Open
  2. In the list of files, click Altair Realtors1 from the preious lesson
  3. In the Navigation Pane, right-click the Properties table and click Design View

Creating an Attachment Field

You can create an attachment field in the Datasheet View or in the Design View of a table. To create an attachment in the Datasheet View:

  • Click Click to Add. In the list that appears, click Attachment
  • To insert a column that would hold attachments, click a cell of the column that will precede it. On the Ribbon, click Fields. In the Add & Delete section, click More Fields and click Attachment

If creating a table in Design View and if you are creating a new column, to configure it to hold one or more attachments, specify its Data Type as Attachment. If a field has already been created and the records have been added to the table, you cannot change the data type of a field to Attachment. You would receive an error when you try to save the table:

In other words, you can specify the Attachment type only if you are creating a new field.

After creating an attachment field on a table, you can configure it on a related form. In the Controls section of the Ribbon, the attachment is represented Attachment.

Practical Learning: Creating an Attachment Field

  1. In the top section of the table, click the first empty cell under Field Name, and type Pictures
  2. Press Tab and, in the Data Type, select Attachment
  3. Save and close the table
  4. In the Navigation Pane, right-click the Properties form and click Design View
  5. In the Design tab of the Ribbon, in the Tools section, click Add Existing Fields
  6. From the Field List, drag Pictures and drop it on the form
  7. Move the accompanying label above the newly added control and change its text to Picture(s)
  8. Appropriately position and resize the attachment placeholder as you see fit

    Properties Listing

  9. Save the form and switch it to Form View

Using an Attachment

You can add the attachment(s) either in the Datasheet View of a table or in the Form View of a form. Once the object is displaying, you can either double-click the field or right-click the field and click Manage Attachments. This would open the Attachments dialog box:

On the table or the form, you can either double-click the field or right-click the field and click Manage Attachments

In the Attachments dialog box, to create an attachment, click the Add button. This would open the Choose File dialog box. It behaves like the Open dialog box. When using it, select the file or object and click Open. The selected object would be added to the Attachments list view. In the same way, you can add the other objects one at a time. Alternatively, to add many objects, in the Choose File dialog box:

  1. To select objects one at a time:
    1. Click one of the objects to add
    2. Press and hold Ctrl
    3. Click each object to add, one object at a time
    4. After selecting the desired objects, release Ctrl
    5. Click Open
  2. To select objects in a range:
    1. Click one object at one end of the range
    2. Press and hold Shift
    3. Click the object at the other end of the range
    4. Release Shift
    5. Click Open
  3. To select objects in a range:
    1. Click somewhere on the left (or the right) or the top (or the bottom) side of an object at one end of the range and hold the mouse down
    2. Drag in the opposite direction to draw a fake rectangle that would touch or include the objects to be added
    3. When the objects have been included in the range, release the mouse
    4. Click Open

To remove an item from the collection, click it in the Attachments list box and click Remove. Once you are ready with the list of attachments, click OK.

After the attachments have been created, to access those of a record, navigate to that record. Then, right-click the placeholder of the attachment. A menu would come up. Among other menu items, the menu has a Forward and a Back options:

  • If the record has only one attachment, both menu items would be disabled
  • If the record has only two items, when you access the record, the Forward menu item would be enabled and the Back option would be disabled. You can click Forward to access the next object. At this time, the Forward menu item would be disabled and the Back option would be enabled. You can click Back to access the previous object
  • If the record has more than two items, when you access the record, the Forward menu item would be enabled and the Back option would be disabled. You can click Forward to access the next object. You can keep clicking Forward to advance in the collection. You can click Back to access the previous object. From the second object to the one before the last, both the Forward and the Back menu items would be enabled. When you get to the last object of the collection, the Forward menu item would be disabled and the Back item would be enabled

Practical Learning: Attaching Objects to a Record

  1. For each record, right-click the placeholder under Picture(s) and click Manage Attachments...
  2. In the Attachments dialog box, click Add...
  3. From the resources that accompany these lessons, inside the Houses folder, locate a file whose 6 (first) characters are the same as the property number.
    If the file name does not end with a, such as 475974.bmp, click it:

    Attaching Objects to a Record

    If the file name ends with a, such as 524880a.bmp, click it and click Open. Then click Add again and add additional files with the same 6 digits in the name and that ends with a letter such as a, b, c, etc

  4. After adding the picture(s), click OK
  5. Navigate to each record. Right-click the picture and review the pictures attached to each record
  6. Close the form
  7. Close Microsoft Access
 
 
   
 

Previous Copyright © 2007-2016, FunctionX, Inc. Next