[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MS-Access for photo collections



There is a way to show a thumbnail with the image record and NOT use an OLE
object field. An OLE object field bloats the database whether or not the
image object is linked or embedded, as has been pointed out already, and
furthermore requires that an OLE compliant image viewer application be the
one to which image extensions are registered on your PC, in order to view
the images within Access. Just a big pain, really.

To get around this, the trick is to use some VBA code behind an image
control on a form which populates itself with the image when the record is
current. Supply a field which contains only the path to the image file, and
the code picks that up. Thus the image file sits wherever you have already
decided it is going to sit, and the database stores only its name and path
in a text field, so minimal storage space is used.

Here's what to do:

1. Put an image control on the form (image, not object frame). Name
it 'ImageFrame'.
2. Add a text field called 'filename' and add a text control for it to the
form (or if you have a field which contains name and path info, use that,
but change the code to match).
3. In the Form properties, set the On Current and After Update events
to '=setImagePath()'.
4. Paste the following code into the form's Visual Basic editor
(choose 'Code' from the 'View' menu while in form design view).

Function setImagePath()
    Dim strImagePath As String
    On Error Resume Next
    strImagePath = Me.filename
    Me.ImageFrame.Picture = strImagePath
End Function

Note that Me.filename is the image pathname from the filename field on the
form, being sent to ImageFrame to use as its Picture property. If your
pathname field is not called 'filename' change the code to match.

I haven't tried using this for displaying multiple records with images in a
report, but I don't see why it couldn't be modified to do that.

That's pretty much it. It's simple and it works well, but it took me 2
months of searching MS Access forums and the very unhelpful help files
before I gave in and phoned Microsoft support directly for this solution. I
develop with both Inmagic DB/TextWorks and MS Access for archives and
libraries and much prefer working with images in the former! Feel free to
contact me if you need more info on this solution.

Peter

&/!&/!&/!&/!&/!&/!&/!&/!&/!&/!&/!&/!&/!&/!
Peter Tyrrell
Consultant
Andornot Consulting Inc.
Authorized Inmagic Reseller
Point Roberts, WA
Phone: 604-264-1299
Toll free: 1-866-266-2525
Fax: 604-269-2527
Email: ptyrrell@andornot.com
Website: www.andornot.com
&/!&/!&/!&/!&/!&/!&/!&/!&/!&/!&/!&/!&/!&/!

A posting from the Archives & Archivists LISTSERV List!

To subscribe or unsubscribe, send e-mail to listserv@listserv.muohio.edu
      In body of message:  SUB ARCHIVES firstname lastname
                    *or*:  UNSUB ARCHIVES
To post a message, send e-mail to archives@listserv.muohio.edu

Or to do *anything* (and enjoy doing it!), use the web interface at
     http://listserv.muohio.edu/archives/archives.html

Problems?  Send e-mail to Robert F Schmidt <rschmidt@lib.muohio.edu>