General discussion

Locked

Display a jpg in Access 2000

By AJD ·
How do you display a jpg image in a form in Access 2000? I can display a bmp, but the jpg just shows the file name.

Is there an easy way (i.e. a button) to automate the insertion of an image file in a database (e.g. medical xray image in a patients record)? Pressing Insert-Object seems clumsy.

This conversation is currently closed to new comments.

12 total posts (Page 1 of 2)   01 | 02   Next
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Display a jpg in Access 2000

by Bob Sellman In reply to Display a jpg in Access 2 ...

Correction to my answer: the control which I said to name "imgPic" should be named "imgDisplay" to agree with the VBA code listed. Sorry about the mistake. I also hope you can read the answer, since all formatting is eliminated when these answersare posted.

Collapse -

Display a jpg in Access 2000

by MerleS In reply to Display a jpg in Access 2 ...

You have to Insert->Picture, or
Toolbox->Image.

Collapse -

Display a jpg in Access 2000

by AJD In reply to Display a jpg in Access 2 ...

allow me to explain further:
I know how to insert a picture in design view, but this will show the same picture in every record. What I want to do is use the database as a repository of images (i.e. xrays, CT scans, etc) that will be displayed as arecord under a patient identifier. I can display BMP's this way but not jpegs - how can I get jpegs to show as an image, not a file name?

Collapse -

Display a jpg in Access 2000

by MerleS In reply to Display a jpg in Access 2 ...

From Access Help:
you do need a separate graphic filter installed to insert all other graphic file formats listed below.
...GIF,JPEG,...
-----------------
AND Professional or Premium Edition of Access.

Collapse -

Display a jpg in Access 2000

by AJD In reply to Display a jpg in Access 2 ...

Poster rated this answer

Collapse -

Display a jpg in Access 2000

by Bob Sellman In reply to Display a jpg in Access 2 ...

On your form, place a control ("txtFileLoc") that contains the data from the column in your table that contains the file location/name. You can make this visible or not. Then in design mode for the form, insert an image. You will need to select any image from your files so the image control will appear on the form. Call this control imgPic. Then add the following code to the OnCurrent property of the form (I've added an asterisk to indicate the start of each line. Don't put the asterisks in your code.):
*If Not IsNull(Me.FileLoc) Then
* Me.imgDisplay.Visible = True
* Me.imgDisplay.Picture = Me.txtFileLoc
* Else
* Me.imgDisplay.Visible = False
* End If
Also add the same code to the OnUpdate property of the txtFileLoc control (if the user is given the option to enter or modify the file name, the new picture will then be displayed). You will encounter an error if the user adds an incorrect path/file name, so if you are permitting users to enter or select new or changed file names, you'll have to add some code to verify that they entered an existing file. You might also add on error code so that a message is displayed if the file name is not valid or not a valid picture.

Collapse -

Display a jpg in Access 2000

by AJD In reply to Display a jpg in Access 2 ...

Poster rated this answer

Collapse -

Display a jpg in Access 2000

by mbarker734 In reply to Display a jpg in Access 2 ...

A few basics first:

The box on your for for containing the .jpg picture is a Unbound Object Frame.

I assume when the Insert Object dialog box opens you are selecting Create From File, if so, this is incorrect and you should select Create New, then select an appropriate photo editor (I use Microsoft Photo Editor 3.0). This editor should be capable of working with .jpg files. Opening the existing file in the editor and then closing the editor should place the appropriate .jpg file on your form.

In the Format properties for you picture field on your form Size = Stretch. This will cause the .jpg file to be scaled to fit the area of the Unbound Object Frame.

Is this process clumsy? ?? YES. Can you shortenthe process? ? only slightly. The clumsiness comes from allowing the versatility of the type of file you can insert into the Unbound Object Frame.

First: Right clicking in the Unbound Object Frame of your form will produce a drop down box with Insert Object as an option. Steps removed none just more convenient than the menu bar.

Second: You can install the following code on an event of the Unbound Object Frame (I like Double Click).

DoCmd.RunCommand acCmdInsertObject

Steps removed 1.

Or if you do not like using and event in the Unbound Object Frame you can create a Command Button with the following code.

Me!MyPicture.Setfocus
DoCmd.RunCommand acCmdInsertObject

Steps removed still only 1. Again, if you discount the one time coding step.

Personally I would opt for the command button, thus leaving the Unbound Object Frame events for other things such as Double Click opening a true viewing program for the .jpg file. Doing this will provide you with the ability to zoom and scroll around on the .jpg file if you desired.

Good Luck

Collapse -

Display a jpg in Access 2000

by AJD In reply to Display a jpg in Access 2 ...

Poster rated this answer

Collapse -

Display a jpg in Access 2000

by Guru di Tutti Guru In reply to Display a jpg in Access 2 ...

In addition to installing the proper graphic filters there is also an extremely friendly
"Active-x Control" included in Access that was developed by MicroSoft.

Although, you'll have to do a little research and/or experimenting with the control, once you understand it's capabilities, you'll use it everywhere.

Create a test form and "Insert" an "Active-x" control from the menu bar. The control you're looking for is titled: "MicroSoft Forms 2.0 Image". It really is powerful! It's treated just like any other screen object and can be placed anywhere (and as often as you'd like) on a form. You can easily load virtually any type of image into this control and size it to your hearts content. After a little bit of research and practice I think you'll really like it.

Back to Web Development Forum
12 total posts (Page 1 of 2)   01 | 02   Next

Related Discussions

Related Forums