In Access 95 and 97, with the proper graphics filters (see A97 Help on "filters,
graphics") loaded, the Image control will display JPG or GIF (or several other image
formats, too). Those filters will not be loaded unless you've done a "custom"
load of Office 97 Pro or of standalone Word 97 with your stanalone Access 97. You simply
set the complete file path and name in the Picture property of the Image control.
If it's a single-user database, you can just store the path and name in your database
and leave the image file itself on your hard disk, setting the path and name, from Access
Basic or VBA code, in the Picture property of an Image control (probably in the OnCurrent
event of a form).
If you have multiple-users or a server database, you can store the image file in an OLE
field (chosen just because there are no file size limitations, not using it as an OLE
object). Read the file in "chunks" using VBA file I/O (opening the file as
binary), and using the OLE field's "AppendChunk" method to add each chunk to the
OLE field. On retrieving the field, use the "GetChunk" method to pull out the
data and use VBA file I/O to write the file to a temporary file on the hard drive, then
set that temporary file's path and name in the Picture property of an Image control.
If you have OLE-enabled software associated with the JPG or GIF file type on the
machine where your application will be used, you can store the images as OLE objects. In
the OLE-enabled image display software, copy the image to the clipboard, then Paste or
Paste Special to an OLE field in Access. The image display software will be used to
display the image, but will also allow the user any other capabilities that it has, such
as editing. The disadvantage of this method is that either Access or the image software
will (always? generally?) create a "thumbnail" in bitmap format and store it,
too, in the OLE field. The bitmap thumbnail has always, in my experience, been larger than
the original JPG or GIF, thus defeating my efforts to save space by using an economical
image format.
Either of these methods can be used in Access 2, as well, but there's no Image control
for Access 2, so you'll need a third- party image display control. One I've used is the
TBASE for Windows View OCX from Videotex Systems. They have a website at www.videotexsystems.com. (I used
this on a project in Access 2.0, it was bought by the company for whom the project was
done, and I was favorably impressed with the product and with the technical support I
received. I offered to review their Access 97 product for my user group and Videotex
Systems provided me a review copy. Those are my only connections with them.) They have
controls also which allow you to modify characteristics of the image (e.g., contrast &
brightness), change the file format, play sound and motion, etc. If you need to do any of
these things, you will need a third-party product even in Access 97.
Also check out this article: Handle/Display images in forms/database
|