Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking to photos in Access 4

Status
Not open for further replies.

bigben

Programmer
Oct 8, 2001
25
RO
Hi there

I want to be able to link photos to records in access and I want to be able to (if possible) view the photographs from within Access as thumbnails.

I did not want to use the OLE object embedder as this uses too much space and was hoping I could use a text field to store the path to the photo and then an active x control to view the photos, but I don't know which active x control to use or how best to go about this.

I would very much appreciate if anyone can give me some advice on this.

Many thanks
 
I have used linking photos. In a report, I have got this code:
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
 On Error Resume Next
 Me![Report-SiteLogo].Picture = Me![Site Logo]
End Sub
Site Logo is the field in the table that stores the file path (c:\my documents\my photo.jpg)

In the report, insert a picture, any picture.
in the properties for the picture, select "Picture" and delete the file path. When asked, say YES to removing the picture.

Now, Change the "Name" to Report-Photo

In the code, use:
Me![Report-Photo].picture = Me![PhotoLocation]

If you have a problem with doing it, post again and I'll try to explain better!

Aubs
 
I alway use the Image tool in the standard Access toolbox ( 10th item in the box )

and code similar to Aubs010 above




G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.
 
Thanks Aubs010,

That was very helpful. What I have now done is I have inserted a picture into the form and then change the path to the picture on the on current event where the picture now gets its path from the text field holding the path to the picture. This seems to work quite well, except you can't use a continuous form to view the pictures but have to scroll one by one.
 
I'm not sure if you can use a continuous form!

In the sample database (northwind) they hav eit as single forms...

Sorry I can't help you any further

Aubs
 
I am hoping someone came up with an answer to bigben's question. I am trying to do the same exact thing. There is no joy with reading the MS Access help or even going to the MS site.

Having to scroll one page per image does not work either, as my report would turn into a forty page monster, ratrher than 3 pages with several thumbnails per page.

I can get the reports to work by embedding the images, but then the database bloats to 40Mb's.

Any guiance would be appreciated.
 
I didn't get past the problem for continuous forms. Though if you are working in a report have you tried putting the photos in the detail section of the report, and then having running an event on the "on format" event for the detail section that changes the path to the picture. I haven't tried this myself, but it might be worth a go. If it does work, you should be able to see several photos per page viewing them vertically.
 
Assuming we are still talking about reports I have a sample database that allows multiple photos on a page.

This was created with much help from Tel-Tips and I would be happy to send a copy to antone that wants it.

I am not a VB guru so you should be able to fugur out how it works

Drop me an e mail if you want a copy

neil_berryman@btopenworld.com

Neil Berryman
IT Trainer
neil_berryman@btopenworld.com
 
Hey folks,

Long time user, first time helper here.

Does it matter what the files are named? If not, you could give them a generic name followed by a number, ie picture01.jpg, picture02.jpg etc.

Then when you make your report, put five or so images on the page, then when the page gets updated, write code to rename all the pictures based on a multiple of the page number and the image frame it goes to.

ie, You have 25 Picures to thumbnail, and 5 image frames per page.

Frame1.Picture = imagePath & "picture" & (page - 1) * 5 + 1 & ".jpg"
Frame2.Picture = imagePath & "picture" & (page - 1) * 5 + 1 & ".jpg"

etc.

Hope this helps.

 
one other option is to set the graphic as "link" instead of "embed". it'll drastically cut down the file size of your MDB, but if you ever move the database you'll need to remember to bring along all the graphics in the exact same directory.

linking works particularly well on reports. on forms it drags down the load time a little, particularly on slower machines.
 
Reply to tedmillerx: Thanks, I tried and thought I did select link as the property. However it all seems to embed.
I thought it would ask me the path where the images lived. It never did.
What I am trying to do is produce a report showing stock photo usage/licensing for a particular client each quarter. The report shows each job and all the images for a particular job.
Each photo has a unique photo number so I am not using an auto number. I store the photos in a separate folder. Usually I just go to the folder, copy the image and then paste the "Picture" into my database. It works, but as I say it makes the database huge.
I would like to make a table within my database with just two fields, photo number and photo. Then when I need the photo in the report, have it link from the table that contains the actual photo.
 
Hi Kojak43,
I tried out my solution, above of just storing the link to the photo in the table as a text field, and using a picture in the report that can represent each photo showing several to a page, and it works fine for me. If you like I can email you a copy of the example database I used to see. You will need, obviously, to change the picture paths in the table for your own pictures. Email me at ben.mango@prospect-us.co.uk and I will send the db.

Also to tedmillerx - even if you use an ole object and use the link option, the database still embeds the object in some way increasing the db file size - whatever Microsoft may say to the otherwise.
 
Did you solve the continuous form problem if not let me know I may be able to help.

Also Bigben did you get it to work the way you wanted it to work, ie opening up the picture in a diffrent window? if not let me know I may have the answer.

Cheers
zeroanarchy

[afro]ZeroAnarchy
Experience is a wonderful thing. It enables you to recognize a mistake
when you make it again.

 
Hi Zeroanarchy,

I did manage to get the database to work the way I wanted, though I would be interested to know how to get the pictures to work using a continuous form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top