Showing images in Forms (1 Viewer)

Phrygian

New member
Local time
Today, 12:38
Joined
Jun 17, 2016
Messages
5
I am using Access 2016.

I am trying to include images in a database but cannot see how to do it. I have had a look in the forum and can see that the question has been raised many times in the past, but the questions either do not deal with my problem or contain solutions in VBA or SQL which are beyond me.

What I am trying to do is design a database dealing with operas. Part of this requires a form and a report which would, for each person on a list of singers, show a CV and a picture. I do not want the picture files to be in the database as it would slow everything down and probably exceed the 2GB limit on the database.

There is a video on youtube by a man called Richard Rost headed " Display images in Microsoft Access Forms and Reports" which is exactly what I am trying to do. It tells me to create a new form, use a text field to show the path to the pictures and set the control source from the image button to this field. I have done all this but cannot see any pictures coming up when I look at the form. I have done this several times setting up new test databases to do so but still cannot see pictures.

I cannot understand why it works for him and not for me. I suspect the only diiference between us is that I am running Windows 10 on an Imac through a virtual machine, but I cannot see how this would make any difference as I have checked the file path carefully.

I do not understand why this should be difficult to achieve. I can see that the position was different for Access 1997 and earlier as it only dealt with OLE but the facility for doing what I want to do seems to have been built into Access 2016.

I assume that I am just doing something very silly. Can anyone tell me what it is? Alternatively, if this bit of Access is flakey, is there another way of doing this without having to write code?

Phrygian
 

sneuberg

AWF VIP
Local time
Today, 05:38
Joined
Oct 17, 2014
Messages
3,506
I suggest zipping a screen shot of your form in design view and upload it or better yet zipping your database and uploading it
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 07:38
Joined
Feb 28, 2001
Messages
27,001
Not writing code? Probably not easy. But you appear to be afraid of something that might be incredibly trivial. Some things just don't bind that well, but with a very small amount of VBA code, you can do small miracles.

In essence, you need to learn now to create an Event procedure for the Form_Current event. In the code for that event, do two things. First, test for the text field that holds your picture's file name so that it is not blank or null. Second, if it passes the text, load the value to the image control's .Image property (which is a text-based property that is the file's fully-formatted file specification).

I cannot understand why it works for him and not for me.

If you don't have a Form_Current event or equivalent, THAT's why it doesn't work for you.
 

sneuberg

AWF VIP
Local time
Today, 05:38
Joined
Oct 17, 2014
Messages
3,506
Not writing code? Probably not easy. But you appear to be afraid of something that might be incredibly trivial. Some things just don't bind that well, but with a very small amount of VBA code, you can do small miracles.

In essence, you need to learn now to create an Event procedure for the Form_Current event. In the code for that event, do two things. First, test for the text field that holds your picture's file name so that it is not blank or null. Second, if it passes the text, load the value to the image control's .Image property (which is a text-based property that is the file's fully-formatted file specification).



If you don't have a Form_Current event or equivalent, THAT's why it doesn't work for you.

I think the need for a current event depends on the version of Access. In the attached database which was create with Access 2013 I have it set up like the OP said his was and it works fine without any code in the current event.

@Phrygian Try the attached database and see if it works on your system. Just open the frmImages and use the Pick Image button to select an image on your system. If you pick a valid image it should show up immediately.
 

Attachments

  • ImageDisplayer.accdb
    396 KB · Views: 341

Phrygian

New member
Local time
Today, 12:38
Joined
Jun 17, 2016
Messages
5
Many thanks to you both for your assistance. I am now considerably wiser but still unable to get what I want.

Doc Man, I read up a little on event procedures and understand the need for them. I even found another video by Mr Rost headed " How to use Images and OLE Objects in your Database". In this, he starts off showing how to incorporate OLE objects before saying that this takes up too much space. He advises keeping the images out of the database and shows how to do this. It is exactly the same as in the the video to which I referred in my original post, with the critical addition of the insertion of a line of code to trigger the event. He says that without this single line of code the images will not show up. Quite how he managed this on the initial video without the line of code I do not know. I tried the code builder to get his single line but all I got was runtime error 2220 saying that Microsoft Access could not open the file.

Sneuberger, your pick button works perfectly. I am not sure what this means, but as you could get Access 2013 to produce an image as I described in the OP, I still do not see why I have a problem.

Perhaps there is a bug in my version of Access or ther is a setting somewhere that needs to be changed. Presumably he only other possibility is that the filepath is wrong but I have checked this.

I shall persevere, but any additional thoughts from you would be much appreciated.
 

sneuberg

AWF VIP
Local time
Today, 05:38
Joined
Oct 17, 2014
Messages
3,506
Perhaps there is a bug in my version of Access or ther is a setting somewhere that needs to be changed. Presumably he only other possibility is that the filepath is wrong but I have checked this.
If you upload your database I'll could test it on my system. That might tell us something.
 

Simon_MT

Registered User.
Local time
Today, 12:38
Joined
Feb 26, 2007
Messages
2,177
Hi Phrygian,

Yes most of the solutions will involve VBA. It is quite a single process. In short

Associate an Image to a singer using a Unique Singer Reference (ID). Then create a mechanism to dump (render) the image into the screen. On Current all you are trying to do is to get the Image for Jussi Bjorling or Victoria de Angeles as I'm looking at La Boheme 1956 version.

Simon
 

Phrygian

New member
Local time
Today, 12:38
Joined
Jun 17, 2016
Messages
5
Success at last.

It turns out that it was nothing to do with Access or my lack of experience. I kept getting notices that Access was not responding, and while I could usually click through them I decided to look at my system. Originally I had Access installed on the C drive, the actual database file in a network storage drive and the images on One Drive. I put everything on the C drive and now it works. I have done a test on a table of about 100 performers and can now get a picture of each of them on a form. I clearly have a network problem somewhere but will park this until I have made some progress on the database.

The next step is link recordings to performers. I have many gigabytes of recordings on the computer and assume that I can use exactly the same procedure to do this. Hope springs eternal, particularly as this takes me into the area of many to many tables.

Many thanks for your help.
 

sneuberg

AWF VIP
Local time
Today, 05:38
Joined
Oct 17, 2014
Messages
3,506
Thanks for letting us know. I'd bet it was the One Drive that was the problem.
 

Users who are viewing this thread

Top Bottom