Revision History
Site Map

Graph: DBPix image storage vs OLE Embedding and Linking in Microsoft Access

Access Component Auto-Install

This sample demonstrates automatic installation and registration of DBPix using files stored in the database.

If you distribute an Access application that uses components (such as DBPix), the components need to be installed on an end-user's system before they can run the application. One way of achieving this without building a custom setup is to include the components in the database itself. When the database is opened a startup form examines the registry to see if the components are already installed, then if necessary the components are extracted from the database and registered on the system automatically.

Download Sample   547 KB


sample screenshot - Access Component Auto-Install
sample screenshot - click to enlarge
Install Prompt
sample screenshot - click to enlarge
Admin Form
sample screenshot - click to enlarge
Test Form
sample screenshot - click to enlarge

System Requirements

Any Win32 (i.e. Windows 95 or later) plus Access 2000 or later.


Unzip the download.


Open the database. The Startup form (Switchboard) opens automatically, which checks if DBPix is installed.

If DBPix is not installed a prompt is displayed that the application needs to install components. Choose 'Yes' to install DBPix. Once DBPix has been installed the 'Open Test Form' button is enabled - click the button to open the form. A photo is displayed using a DBPix control to verify the installation.

If you already have DBPix installed you can use the form 'frmComponentAdmin' to unregister DBPix so that the startup form performs the installation, as follows:

   Close the Switchboard (and the Test form, if open).
   Open 'frmComponentAdmin'.
   Click 'UnRegister Component'. Click 'OK' to dismiss the confirmation dialog.
   Re-open the Switchboard, which will prompt to install components, then proceed as above.

'frmComponentAdmin' can also be used to manually initiate installation and to load a new version of the DBPix .ocx file.

Technical Overview

This updated version of the sample offers reduced size, enhanced performance, and improved reliability. Additionally the sample is designed to work from read-only devices, such as a CD-ROM or DVD.

To incorporate this functionality into your own application import all the tables, forms and modules into your database.

Your database must have a startup form (eg a switchboard) which opens automatically when the database is opened; this form must use 'tblComponents' as its data source. In this form's Form_Open event call 'VerifyComponentInstall' to check, and if necessary install, DBPix. VerifyComponentInstall takes three parameters, which are the fields from 'tblComponents' containing the binary itself, the target filename, and the registry key to examine in order to see if DBPix is already installed. If you do not wish the user to see a startup form then you can close the form immediately after the call to VerifyComponentInstall. Note that the startup form must not contain a DBPix control.

You can delete form 'frmTest' and table 'tblImages' - these are only used to verify the installation in the sample.

You may also want to delete the form 'frmComponentAdmin' - this is only used to update the sample with new versions of components, or for testing and diagnostics.

The following should be performed as the final step before releasing your application:

Verify that there are no references to DBPix (in 'Tools' -> 'References' from a code window). Access sometimes adds a reference by itself. The reference is unnecessary, and will prevent the application from starting if DBPix is not installed.

Finally, before releasing the software, you should ensure that the code is freshly compiled, and then perform a 'Compact and Repair'.