Microsoft KB Archive/123151

= ACC: Why OLE Objects Cause Databases to Grow =

Article ID: 123151

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 1.0 Standard Edition
 * Microsoft Access 1.1 Standard Edition
 * Microsoft Access 2.0 Standard Edition
 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q123151



SUMMARY
Advanced: Requires expert coding, interoperability, and multiuser skills.

A Microsoft Windows OLE object is stored as an OLE stream that consists of two portions:


 * Information to render the object.
 * Native data that can be modified by the OLE server that created the object.

Microsoft Access stores the entire OLE stream in an OLE wrapper in a type of Long Binary field.

The amount of information used to render the object is often greater than the size of the object itself. Adding such OLE objects can increase the size of a database significantly. To minimize size increases caused by adding OLE objects to a database, use either of these methods:


 * Make the object easier to render (by lowering the resolution of the object, or decreasing its physical size).
 * Display the object as an icon.



MORE INFORMATION
An object's rendering information can be in any of the following formats:


 * Windows Bitmap format (BMP)
 * Windows Metafile format (WMF)
 * Windows Device-Independent Bitmap format (DIB)

An OLE server offers formats in order from the server's most-to-least preferred format. An OLE client enumerates the available formats and uses the first compatible format. Generally, you can override the OLE client's choice of formats with the Paste Special command.

Typically, either WMF or DIB is chosen, because OLE servers render these formats most easily. For example, Microsoft Word for Windows typically renders using WMF, while Windows Paintbrush renders using DIB. An OLE client can always choose the format it prefers first. Because DIB is a form of BMP, most servers that render in DIB also render in BMP, although DIB is often offered first. Microsoft Access always chooses DIB over BMP.

OLE servers that can display pictures stored in other compressed formats, such as the JPEG format (JPG), must still send the two portions of information described earlier in this article. The server must send information to render the object using BMP, WMF, or DIB, as well as native data that can be used to edit the object. When this occurs, the compressed format is converted to a format to be rendered. The size of the OLE stream is the sum of the converted rendering object, the native data, and some OLE overhead information. Because the OLE stream contains all of this information, small objects in compressed formats can become quite large when stored in a Microsoft Access database.

One way to work around this behavior is to store the object as an icon. If you do not need to display the object in a Microsoft Access form or report, you can store the object as an icon that represents the object type. Storing an object as an icon causes the OLE server to send the object with rendering information consisting of only the icon rather than the complete object, using significantly less storage space in the database. When you double-click the icon, the OLE server is launched with the native data that the icon represents.

Another example of a small file growing to become a large OLE object is a Microsoft Word file that contains complex text formatting or an image on the first page of the document. The small amount of native data requires so much information for rendering that the OLE object is quite large. To work around this behavior, place a page with simple formatting at the beginning of the document, or store the document as an icon.

OLE has a preferred order for using the standard presentation formats. Regardless of where WMF appears in the format order, it is used if it is available (metafiles provide better scaling than bitmaps). If WMF is not available, DIB is preferred over BMP. OLE currently supports only WMF, DIB, and BMP.

One of the options in the OLE Specification calls for OLE servers to add more rendering formats to the three default formats that Windows supports. Microsoft Access does not currently support this OLE feature.

