How to Display Record-Specific Images in Access Forms Using Relative Paths
Question details
The user needs to display dynamic images for different records in an Access database without breaking the image links when the file is moved to another computer.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Developing an Access database with forms or reports that include images tied to specific records, intended to be portable across different computers or shared network drives.
- Observed behavior
- Hardcoded absolute file paths fail to load images when the Access database file is moved or shared with other computers that do not share the exact same folder structure.
Gather all your image files into a dedicated subfolder located in the same directory as your main Access database file. Ensure your database tables are backed up before making structural changes to your image path fields.
Use Relative Image Paths and a System Settings Table
Implement a dynamic path structure by storing a configurable base directory path in a settings table and only storing relative image names in your main data table.
By separating the root directory path from the image file name, you only have to update a single record in your database when moving the file to a new computer. Access can automatically combine the base path and the relative file name at runtime to display the correct image.
Create a new table named 'tblSettings' with a short text field called 'BaseImagePath'. Enter the parent directory path where your images are currently stored (e.g., 'C:\Users\Name\Pictures\').
Modify your main table's image field to store only relative paths for the images (for example, '2022\1.jpg' or simply 'image1.jpg') instead of the complete absolute path.
Open your target form or report in Design View. Go to the Form Design tab, select the 'Image' control, and click on your form to insert it. Leave its default 'Picture' property blank.
Add an invisible text box to your form that retrieves the base path from 'tblSettings' using a DLookup function, and concatenates it with the relative path from the current record (e.g., '=[BaseImagePath] & [RelativeImagePath]').
Open the form's property sheet, navigate to the 'Event' tab, and click the builder button next to 'On Current'. Add VBA code to set the image control's picture property to the concatenated path: 'Me.YourImageControlName.Picture = Me.YourInvisibleTextBoxName'.

Manage Your Data Efficiently with WPS Office
While Microsoft Access handles complex relational databases, many data tracking, cataloging, and reporting tasks can be efficiently managed using WPS Spreadsheet. WPS Office provides a free, lightweight, and highly compatible alternative to Microsoft Office for creating professional documents, managing spreadsheets, and designing presentations.
- 1. Download and Install: Visit the official WPS website to download the free WPS Office installer and follow the on-screen instructions.
- 2. Export Access Data: In Microsoft Access, export your tables or queries to an Excel (.xlsx) file format.
- 3. Open with WPS Spreadsheet: Launch WPS Spreadsheet and open the exported file to manage your data, filter records, and insert images directly into cells.

Frequently Asked Questions
Why do absolute image paths break when sharing an Access database?
Absolute paths (like 'C:\Users\John\Images\pic.jpg') point to a specific user profile and drive letter. When the database is copied to a different computer, that exact folder structure usually doesn't exist, causing Access to fail to find the referenced image.
Can I embed images directly into the Access database instead of using file paths?
Yes, you can use the OLE Object or Attachment data types to embed images directly. However, this is generally discouraged for large datasets because it drastically increases the file size and can quickly push the database toward the strict 2GB size limit in Access.
How do I prevent Access form errors if an image file is missing?
You can use a VBA error-handling routine in the form's 'On Current' event. Use the Dir() function to check if the file path exists before setting the image control's Picture property. If the file is missing, you can program the form to load a default 'Image Not Found' placeholder picture instead.




