|Microsoft Access is very inefficient at storing images in tables. A 50 kb jpg
file can actually consume 1 Mb in an MDB. Access is storing a thumbnail
copy of the image but in bitmap (bmp) format.
ACC: Why OLE
Objects Cause Databases to Grow - 123151. Thus you really, really
want to investigate some alternatives. In Access's defence bmp format
files are uncompressed and thus require no CPU to decompress them. This
was very important back in the days of 80386 processors.
If you really, really need to keep the images in the MDB consider using VBA code and BLOBs, binary large objects, thus avoiding creating the bmp thumbnail copy. See AppendChunk and GetChunk in the online help.
Downloadable sample VB code
Tips and Tricks
What I also do is put incoming images in an "import" directory, quite often the default directory chosen by the camera or other graphical input device, and move them to another directory when they have been matched. This way you know what photos you have left to process. I also give the users an option of deleting the photo's.
I then display this list of photos in a list box in the top half of the form using a call back function. Whenever the user clicks on a photo I display the photo in the bottom half of the form and unlock some command buttons and fields.
Alternatively if the image is fairly large, that is larger than a photograph,
or other files involved such as PDFs, I then use the ShellExecute API call to
run whatever viewer is associated with that file extension.
Problems with Reports
Stephen Lebans recently informed us that using the OnPrint event rather than the OnFormat event has been suggested by Microsoft's tech support to alleviate running out of memory or system resources when printing images.
Stephen Lebans has stated that Microsoft has determined that the long-time problem of leaking memory in reports using image controls does not occur if the image files are .BMP.
BMPs load a lot faster than other formats as they are not compressed especially on older slower systems. This then becomes a trade-off between increased file size and performance. This may no longer be true on 2 Ghz CPU systems with ATA 133 hard drives.
Loading Image dialogue
Getting tired of seeing that Loading Image dialogue flicker? Getting errors by users who click on things before this is finished displaying? Try creating/changing the following registry key as per the Access WEB at API: Suppress the "Loading Image" dialog
As always make a backup of your registry and make changes to registry entries at your own risk.
Joe Fallon, fellow MVP, states "I use the Tab control to "hide" the image on a different "page". I also move the code to the OnGotFocus event of the ImagePath text box which is on the next page of the Tab control. This way, the only time the picture loads is when the user clicks the tab to see it".
(Thanks for Frank Miller of Microsoft for supplying the original version of the following info and
Q294255 ACC2000: Err Msg When You Attempt to Display Images on a Form
Kodak Imaging Controls which come with various versions of Windows up to and including Windows 2000.
I wouldn't bother trying to work with these controls given that they don't come with Windows XP and, last time I found them on a website, they wanted you to purchase them for each user.
A set of graphic handling controls which comes with Win NT4, Win 95, 98 and Windows 2000 are the Kodak Imaging controls (formerly the Wang Imaging controls). These controls do not come with Windows XP. They are an optional install which can be verified by looking for Imaging under Accessories.
These controls cannot be redistributed as per the KB article INFO: Cannot Distribute Eastman or Wang Imaging Controls [Q190036]. However this article no longer exists. The product is now know as eiStream Imaging for Windows. No, that website redirects to Global360.com (I used to have a direct link to the product but these people insist on changing URLs so you're going to have to search for them. And with all those name changes who really cares about such a product.) It would also appear that you must purchase licenses for each user of your product. Thus you will want to consider purchasing another product which does allow royalty free redistribution.
I have no idea what versions of these controls come with which version of Windows and no idea on their functionality. You could try searching at support.microsoft.com or msdn.microsoft.com. Information on these controls is rather sparse.
[ Access | Main ]