How display digital camera photo on form and print on report?

D

drb

A client wants to add digital camera photos to a multiuser equipment
maintenance database. I do not plan to store the photos in the .mdb,
but rather in a folder in the same location as the .mdb. In the .mdb I
plan to store the equipment id, the path to the photo, and other fields
that will allow multiple photos of a piece of equipment on the same day
plus other fields to make the equipment id unique for each photo.

So far so good! What object do I use to show the photo on a form? An
unbound object frame sounds like what I want, but can't see how to
specify the path to the photo. Where am I going wrong? Sample code?
Once I can figure this out I should be able to use the same methods to
include the photo on a printed report. Yes?

drb
 
R

Rob Parker

You should use an Image control to display the photo. Here's a snippet of
code I use to display the image file for a particular record; this is placed
in the Current event of the form. The full path/filename of the image file
is in a textbox control named txtImageFile, bound to the table field where
the path/filename is stored. I use the same code in the AfterUpdate event
of the textbox to update the picture if the path/filename is changed.

If Not IsNull(Me.txtImageFile) Then
Me.imgImage.Picture = Me.txtImageFile
Else
Me.imgImage.Picture = ""
End If

The same thing works in a report, except you use the Format event of the
report section which contains the image control (that's the equivalent of a
form's Current event).

And one other tip - if you set the Size Mode of the image control (it's on
the Format tab in the Properties dialog) to Zoom, your image will resize to
fit the control, and retain it's aspect ratio.

Finally, to prevent possible crashes when scrolling through records or
report pages, you should incorporate the registry changes described here:
http://www.mvps.org/access/api/api0038.htm

HTH,

Rob
 
D

drb

Thanks Rob -- I'll try your suggestions. Somewhere I thought I read
that image control objects become part of the .mdb, that's why I was
looking at the unbound object frame.

drb
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top