Solved

Loading Images into a Database and writing to Disk

Posted on 2010-11-19
4
639 Views
Last Modified: 2012-06-27
I would like to know how to load an image from disk to a table in Access and when needed how to write that image back to the file system.
I want to store images in a table within Access 2010 in case my users delete or rename various graphic images from the file system. These images include the program icon and several images that are used for reporting.
Upon startup, I would like my application to check if these images have been moved, renamed, or deleted and write them back to the disk if needed.
As a side benefit, this type of solution would also allow me to version-control these images instead of using the file system. (I probably would only include the latest images in my distribution to users).
This is for a single-user application that is distributed nationally to individual users via front and back-end executable (.accde) programs.
I know that storing images in a database can use a lot of space, but that is not the issue to be addressed in this question. There are only 5 images that needs to addressed in this manner.
Thanks.
0
Comment
Question by:RCUllrich
  • 2
4 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 34174231
2010 includes the Attachment field, which can be used to store your images.

Here's a blog post about using VBA to work with items stored in an Attachment field:
http://blogs.msdn.com/b/access/archive/2007/08/24/adding-removing-and-saving-files-from-the-new-attachment-field-in-access-2007.aspx

Here's some info about the Attachment fieldtype:
http://www.databasedev.co.uk/access2007attachment.html
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34176325

<No Points wanted>

    "I would like my application to check if these images have been moved, renamed, or deleted and write them back to the disk if needed."

Why not simply only allow Read permissions to the Image folder? (Denying all other permissions)
In this way, checking the validity of the images should be rare occurrence.

JeffCoachman
0
 
LVL 3

Author Comment

by:RCUllrich
ID: 34179636
LSMConsulting: Thanks for the information regarding the new features in Access 2007 and Access 2010. I just concluded a week where I worked 60 hours for a client and have not had a time to test the new "Attachment" feature but will soon and award points. That looks like a great feature - I did not read that section of the various referencing I have used for new features.

Jeff - I use SageKey for creating the installation program and will certainly consider setting the permission for my images folder. It does bring up the issue regarding the permissions my program would have to "write" to that location in the event a user removed one of the images. I will need to add error handling code to the program warn that a report is not available if the user has deleted an image used on that report. Thanks!
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34183952
OK
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now