Revision History
Site Map

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

Display Web Images in Access Forms and Reports

This Access sample database shows how to display images from a web address (http url) in an Access form or report. The sample uses the XMLHTTP object (available on most Windows systems) to fetch the image, then the image is displayed in a DBPix image control. The image is handled entirely in memory, avoiding the need to manage temporary files.

Download Sample   25 KB (Requires DBPix)

Download DBPix  3.7 MB ( About DBPix )


sample screenshot - Display Web Images in Access Forms and Reports
Main Form
sample screenshot - click to enlarge
Zoom Form
sample screenshot - click to enlarge
sample screenshot - click to enlarge

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 download then open the mdb file in Access.


Open the form 'frmXMLHTTP'. The form displays some sample images from our website, along with a Title and the image url. As you scroll through the records the images are retrieved and displayed in the DBPix control. Right-click the image to view available tools - choose 'Image Info' to display the info window and click the EXIF tab to view the EXIF info in the image. Close the Info window then double-click the image to open a larger view.

Close the form then open the report 'rptXMLHTTP' to preview a report showing the images from the website.

Technical Overview

The code in each of the forms and the report is nearly identical. In the Form or Report's 'Open' event an XMLHTTP object is created for fetching images throughout the lifetime of the form or report. The XMLHTTP object is destroyed in the form or report's 'Close' event.

In order to display the image for the current record the report's 'Detail_Print' or the form's 'Form_Current' event calls 'UpdateImage'. 'UpdateImage' first clears the DBPix control, then checks that the XMLHTTP object was successfully created. If the 'url' field contains data the XMLHTTP object is used to request the image, then the code enters a loop to wait for the image to be retrieved. When the request is complete the HTP status code is checked for a 200 (OK) value then the image is directly displayed in the DBPix control by loading the 'responseBody' property, avoiding the need to create temporary files.

The 'frmXMLHTTP' form contains additional code to open a larger view of the image in a popup window. The DBPix control's 'DblClick' event is handled, which checks for a valid XMLHTTP object and for data in the 'url' field. The 'frmZoom' form is then opened, passing a WHERE clause to limit the form to show the current record only (filtering by the Id of the current record). The image display code in 'frmZoom' is identical to that in 'frmXMLHTTP'.

Files & Code

File / module Description  

frmXMLHTTP Form code for main form. View Code
frmZoom Form code for popup 'Zoom' form. View Code
rptXMLHTTP Report code. View Code

Revision History

Date Filename Description

17 Jun 2008   xmlhttp-v3.zip   Improved error-handling, code structure and documentation. Added Popup Zoom form.
5 Jun 2008   xmlhttp-v2.zip   New Design.
16 Feb 2008   xmlhttp.zip   Initial Version.