Is there a way to get ms-access to display images from external files
Asked Answered
C

7

6

I've got an MS-Access app (1/10th MS-Acccess, 9/10ths MS-SQL) that needs to display photographs of some assets along with their specifications. Currently the images are stored in an MS-Access table as an OLE Object (and copy-n-pasted into the field by the users).

For various reasons, I would like to do is store the original .jpgs in a folder on the network drive, and reference them from the application portion. I have considered moving into MS-SQL's image data type (and its replacement varbinary), but I think my user population will more easily grasp the concept of the network folder.

How can I get MS Access to display the contents of a .jpg?

Catechist answered 2/9, 2008 at 17:34 Comment(0)
F
8

Another option is to put an image control on your form. There is a property of that control (Picture) that is simply the path to the image. Here is a short example in VBA of how you might use it.

txtPhoto would be a text box bound to the database field with the path to the image imgPicture is the image control The example is a click event for a button that would advance to the next record.

Private Sub cmdNextClick()
    DoCmd.GoToRecord , , acNext
    txtPhoto.SetFocus
    imgPicture.Picture = txtPhoto.Text
    Exit Sub
End Sub
Filet answered 3/9, 2008 at 1:44 Comment(0)
A
3

Have you looked at Stephen Lebans' solutions? Here's one:

Image Class Module for Access

Check out the list of other great code along the left-hand side of that web page. You may find something that fully matches what you need.

Amphipod answered 15/9, 2008 at 21:25 Comment(2)
This may get the job done, but I'm reluctant to follow a tutorial from 2002 using Access 97 in the year 2013.Orosco
Sadly access didn't develop too far from what it was when leban wrote those tutorials. I recently did some graphic works in access and those came in very handy - actually they were the best resources I could find in this regard.Colossal
A
2

I found that this article by Microsoft with full VBA worked very well for me.

How to display images from a folder in a form, a report, or a data access page

Aronarondel answered 3/9, 2008 at 8:37 Comment(0)
P
0

The easiest way is probably to plop an Internet Explorer onto one of your forms. Check out this site: http://www.acky.net/tutorials/vb/wbrowser/

Since you can reference that object in Access, you will only need to point the webbrowser control to the path of the .jpg (NavigateTo() if I remember correctly).

EDIT: The above link was just googled and picked from the results (first one that opened quickly). I do not think it is a very good tutorial, it just has all the pointers you need... Check out msdn etc. if you need more information!

Pelasgian answered 2/9, 2008 at 18:7 Comment(0)
T
0

You can try an ActiveX control called AccessImagine, makes adding images to database more convenient - you can load from file, scan, paste from buffer or drag-n-drop. You can crop image right inside the database and resample it automatically. It handles external image storage automatically if you need it.

Tsar answered 4/7, 2009 at 1:31 Comment(0)
C
0

Note that in Access 2010 (and later) this is dead simple to do because the Image control can be bound to a field in the table that contains the path to the image file (.jpg, .png, ...). No VBA required.

For more details see my other answer here.

Catina answered 15/9, 2014 at 22:49 Comment(0)
C
0

Do you mean something like this? Display images in MS-Access Form tabular view.

Here's the original post from microsoft:

https://learn.microsoft.com/en-us/office/troubleshoot/access/display-images-using-custom-function

You just need to modify something in the form events:

Modify this part of the form code

Image Control
Name: ImageFrame
Picture: "C:\Windows\Zapotec.bmp"
Control Source: txtImageName

Note that the Control Source named "txtImageName" is the field name in your table which has the name and path of your images.

Everything get's fine after you modify that part.

Checkrow answered 15/2, 2023 at 12:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.