Perhaps the least understood of all , the OLE Object data type lets you store files created in other programs such as graphics, Excel spreadsheets, or Word documents. This lesson will give you some practice working with OLE object fields.
Select the tblEmployees table and click the Design button.
First we need to add an OLE field to this table.
Click the first blank Field Name row and type
Photo. Click the Data Type list arrow and select OLE Object from the list.
You've created an OLE Object field!
Save your changes and then click the View button on the toolbar to display the table in Datasheet view.
Let's try adding an OLE object to the Maria Wyatt record.
Click in any field for Maria Wyatt, scroll to the right, click in the Photo field for the Maria Wyatt record (using the record selector as a guide), and select Insert » Object from the menu.
The Insert Object dialog box appears, as shown in figure. You can create and then insert new objects by selecting the Create New option or you can click the Create from File option to insert an existing file. For this exercise, we already created and saved a photo, so you need to select the Create from File option.
Click the Create from File option.
The Insert Object dialog box displays the Create from File options, as shown in figure. Here you will specify the name and location of the file you want to insert.
Click the Browse button.
Now you need to find and locate the file you want to insert into your document.
Browse to your Practice folder, then find and double-click the Maria.bmp file.
The name and location of the Maria.bmp file appears in the File box. Before we close the Insert Object dialog box, there is one more very important option we need to explore the "Link" check box. The "Link" check box determines whether the OLE object is actually embedded within the database or merely linked to it. This is a rather difficult concept for most people you might want to look at table for more on the differences between the two.
For this exercise, we want to embed the graphic within the database, so we'll leave the Link box unchecked.
The dialog box closes, and Access embeds the Maria.bmp picture in the Photo field.
The problem with working with OLE object fields in Datasheet view is that you can't see the actual OLE objects. It's for this reason that you may want to use a form to work with OLE object fields.
Close the tblEmployees table. Click the Forms icon in the Objects bar, click the frmEmployees form, and click the Design button.
First we need to add the new photo field to the form.
Click the Field List button on the toolbar, if necessary. Click and drag the Photo field anywhere on the form.
Another way to display the field list is to select View » Field List from the menu.
Don't worry about where you place the Photo OLE object field or if it covers other fieldswe're not striving for perfection here. As with any other form control, you can move and resize OLE object fields.
Let's see how the Photo field looks in Form view.
Click the View button on the toolbar to switch to Form view. Click the Next Record Navigation button until you find the record for Maria.
Yep! There's the picture!
Close the frmEmployees form without saving any changes.