load linked image in forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to set up a form with a text field that will be a file path, then have an image object automatically display the linked .jpg file in MS Access 2003. It would be even better with a Browse button for the text field.

I have very little coding experience, so the simpler the better! Any help, suggestions or resources?
 
The simple way to do this would be to use a Hyperlink field in your table.
If that's new, see:
Introduction to Hyperlink fields
at:
http://allenbrowne.com/casu-09.html

You could then put a button on your form to fire the Insert Hyperlink
dialog. The Event Procedure for your button would simply put focus to the
right control (because the button has focus when you press it), and then
open the dialog:
Me.[NameOfYourHyperlinkHere].SetFocus
RunCommand acCmdInsertHyperlink

The user can then click on the hyperlink to view the file.

The text field has some advantages, but does require an understanding of
programming, and there are some bugs to avoid. Firstly, the API call to get
the FileOpen dialog is available at:
http://www.mvps.org/access/api/api0001.htm

Next, the information on how to display images in a form is available here:
http://www.mvps.org/access/forms/frm0030.htm

Finally, the bug you need to avoid is described here:
http://www.mvps.org/access/bugs/bugs0044.htm
 
I'm trying to set up a form with a
text field that will be a file path, then
have an image object automatically
display the linked .jpg file in MS
Access 2003. It would be even
better with a Browse button for
the text field.
I have very little coding experience,
so the simpler the better! Any help,
suggestions or resources?

The sample imaging databases at http://accdevel.tripod.com illustrate three
approaches to handling images in Access, and the download includes an
article discussing considerations in choosing an approach. Two of the
approaches do not use OLE Objects and, thus, avoid the database bloat, and
some other problems, associated with images in OLE Objects.

Some knowledge of VBA will be required, but you can copy much of the code
directly from the examples.

Allen's approach may be simpler if you do not want to work on your VBA
coding skills.

If you are printing the images in reports, to avoid memory leakage, you
should also see MVP Stephen Lebans' http://www.lebans.com/printfailures.htm.
PrintFailure.zip is an Access97 MDB containing a report that fails during
the Access formatting process prior to being spooled to the Printer Driver.
This MDB also contains code showing how to convert the contents of the Image
control to a Bitmap file prior to printing. This helps alleviate the "Out of
Memory" error that can popup when printing image intensive reports.

Larry Linson
Microsoft Access MVP
 
Back
Top