Others

How to Open an Image with a Double-Click Event in Access

Steven ParkerSteven Parker Oct 28, 2026 870 views

Question details

The user wants to dynamically open a specific image clicked in a continuous Microsoft Access form without hard-coding the path to a specific Photo Viewer DLL.

How to Open a Specific Image with a Double-Click Event in Microsoft Access
Product
Microsoft Access
Device & OS
Windows
Scenario
A continuous Access form displays multiple photo records. The goal is to open the full-size version of whichever specific image the user double-clicks.
Observed behavior
The current approach relies on a fixed DLL path for Windows Photo Viewer, which fails or lacks flexibility. The goal is to pass the correct image path to the system's default image viewer instead.
Before you start

Ensure that the file paths stored in your Access database correctly point to the accessible image files on your local drive or network, and verify that Windows has a default image viewer assigned.

Solution 1Recommended

Use Application.FollowHyperlink in VBA

Replace hard-coded DLL calls with the Application.FollowHyperlink method to securely open the clicked image in the user's default Windows image application.

Using Application.FollowHyperlink is the standard best practice for opening external files from Microsoft Access. It delegates the task to the Windows operating system, which automatically uses the default application assigned to that specific file type (e.g., JPG, PNG).

This approach completely eliminates errors caused by missing, moved, or outdated DLL files associated with older Windows Photo Viewer versions.

1
Open Form in Design View

Right-click your continuous form in the navigation pane and select 'Design View'.

2
Access Control Properties

Select the image control or the text box that contains the file path for the image. Open the Property Sheet (F4).

3
Navigate to the Event Tab

In the Property Sheet, click on the 'Event' tab and locate the 'On Dbl Click' property.

4
Open VBA Editor

Click the ellipsis (...) button next to the 'On Dbl Click' field and choose 'Code Builder' to open the VBA editor.

5
Insert the FollowHyperlink Code

Enter the following code inside the event sub: Application.FollowHyperlink Me.YourImagePathControlName (ensure you replace 'YourImagePathControlName' with the actual name of the control holding your file path).

6
Save and Test

Save the VBA module, switch back to Microsoft Access, change the form to 'Form View', and double-click an image to verify it opens in the default Windows image viewer.

Use Application.FollowHyperlink in VBA
Optimization Tip: For better form performance, store a small thumbnail path for form display and a separate high-resolution path. Point the FollowHyperlink command to the high-resolution path.
Free Microsoft Office alternative

Simplify Your Work with WPS Office

While Microsoft Access handles complex relational databases, many everyday data management, filtering, and reporting tasks can be easily managed using spreadsheets without writing VBA code. WPS Office provides a lightweight, highly compatible, and free alternative to Microsoft Office, ensuring seamless handling of your daily document and data needs.

  1. 1. Download the Installer: Visit the official WPS Office website and download the free installation package.
  2. 2. Install WPS Office: Run the downloaded file and follow the on-screen instructions to install the suite on your computer.
  3. 3. Start Managing Data: Open WPS Spreadsheet to easily manage, sort, and analyze your data sets without the need for complex database programming.
Highly compatible with Microsoft Excel (.xlsx), Word (.docx), and PowerPoint (.pptx) formats.Lightweight and fast, requiring significantly less system resources than traditional office suites.Free to use with a familiar, easy-to-navigate user interface.Built-in PDF editing tools for streamlined document management.
QA img-9

Frequently Asked Questions

Why doesn't my image open when I double-click the Access form?

This usually happens if the file path stored in your database is incorrect, missing, or if the VBA code references the wrong control name. Ensure your code points exactly to the text box or field containing the valid file path.

How do I change the default image viewer that opens my files?

In Windows, go to Settings > Apps > Default apps. Look for 'Photo viewer' or search by file type (like .jpg) and select your preferred application. Access will automatically use this setting when running Application.FollowHyperlink.

Can I open images stored as OLE objects using Application.FollowHyperlink?

No, Application.FollowHyperlink only works for external file paths stored as text (e.g., 'C:\Photos\image.jpg'). If your images are embedded directly into the database as OLE attachments, you will need to extract them first or use the default attachment controls to view them.

How can I improve my Access form's loading speed with many images?

Instead of loading high-resolution images directly into the continuous form, generate and display small thumbnails. Store the path to the high-resolution image in a hidden text box and call that hidden field during the double-click event.