Revision History
Site Map

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

Batch-Load Images, Pictures & Photos in Access

This sample illustrates how to select a folder and load all of the image files in that folder into an image/graphic/photo/picture database application, using Access forms. Main and thumbnail images are created and stored at fixed sizes/resolutions. Examples are provided for both embedded and external-file storage (ie images stored in the database tables, or as external image files).

Note that this sample is now updated for DBPix 2.0, and is incorporated into the Main DBPix sample - the latest version is available below:

Download Sample   1.2 MB (Requires DBPix)

Download DBPix  3.7 MB ( About DBPix )


sample screenshot - Batch-Load Images, Pictures & Photos in Access - graphics database samples

System Requirements

Any Win32 platform (e.g. Windows 95, 98, ME, NT, 2000, XP, Vista, Server 2003 or Server 2008).
Access 2000 or later (Access 2000, XP/2002, 2003 or 2007).
DBPix 2.0


Unzip the archive into a new/empty folder.


Open the form 'Embedded_Main' or 'External_Main', to work with embedded images or external files respectively.

Use the form navigation buttons to view the existing records in the database. Right-click on the main image to see the available tools or to display image info, such as the EXIF photo info (from digital camera).

Click the 'Batch Load' button to select a folder and load all the jpeg image files in that folder into the database. Note that selecting a folder containing many high-resolution images may take some time to process, due to the resampling and encoding of the main and thumbnail images.

Technical Overview

On clicking the 'Batch Load' button the user is prompted with the common 'Browse for Folder' dialog, using the module 'BrowseForFolder' (courtesy of Terry Kreft - see 'The Access Web' in 'Links').

If a folder is chosen, a directory listing of all files matching the required specification is created (*.jpg, in this example). For each file, the form is moved to a new record (using DoCmd.GoToRecord) and the image file is loaded into the main DBPix control. This causes the control's 'Image_Modified' event to be fired - the event handler updates the thumbnail (both controls are configured to automatically resample the image to the required dimensions), and also saves some image info in the table.

Notes on the 'External' version:
The Image_Modified event handler also saves the new/updated images to files (in the 'Embedded' samples the images are saved to the table automatically by data-binding). The form's OnCurrent event handler displays the current image files in the DBPix controls. For both viewing and saving, the path is obtained from the 'GetImgFolder' function (in module 'GetImageFolder'), which returns the 'images' sub-directory, relative to the location of the .mdb file.

Files & Code

File / module Description  

Embedded_Main Form module for the 'Embedded' example View Code
External_Main Form module for the 'External' example View Code
BrowseForFolder Displays the common 'Browse for Folder' dialog View Code
GetImageFolder Returns the path for external image files View Code