Revision History
Site Map

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

The Access Image FAQ < Previous ArticleNext Article >

Use autonumber fields for image file names

When building an image database that links to external image files there are 2 possibilities for how and where to store the images:

1) Link to the images directly in their original location.
2) Copy the image file to some common location that is managed by the database, and link to it there.

In the case of 2) we have to consider how the files will be named once copied to the central location. If we keep the original filename there is the possibility of duplicate filenames - users could select 2 images with the same filename from different folders, and once copied to the central location the second image would overwrite the first. If your image source is a Digital camera, many devices rotate and reuse filenames, so after some period there will likely be a conflict.

You could use data from the table to name the files, eg the value of a 'LastName' field, but then what happens if the user tries to load an image before entering the name? Furthermore, such values are not usually guaranteed to be unique, so if a new record is added with the same name as an existing one then this scheme breaks-down. Similarly, if a name was entered with a spelling mistake, and later corrected, the link would be broken.

One answer is to use an 'AutoNumber' field for the filename. These are guaranteed by the database to be unique and conflict-free, resolving the problem of duplication, and then we are not relying on the user to have entered any specific data in order to have the filename available. Autonumber values are almost never changed, so there is a strong relational link to the record.

Although autonumber filenames are not recognisable (as using a person's name would be) this is usually a benefit - ideally users shouldn't access the image files directly, or there is an increased risk of errors which compromise data integrity (e.g. accidental deletions or edits). If users need access to a file (e.g. for insertion in an email or document) you can provide a 'Copy' function to use the clipboard, or 'Save a Copy' to save a copy of the image to the user's local disk drive.

Related Articles

Parse the Folder or Filename from a Full Path
Get the Path to the Database (.mdb) File
Use Relative Paths for Linked Images

Imaging for Access that's Easy, Efficient & Fast
  • NO OLE Bloat
  • NO App Dependencies
  • NO Complex Coding
  • NO Performance Penalty
  •  DBPix logo
    Read More

    Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.