Solved

Duplicate Photos on Subform.

Posted on 2011-02-19
10
865 Views
Last Modified: 2012-05-11
I have a subform that shows people's pictures.  there is a field called txtImageLocation that stores the location of the photo on my server.

On the form_current I have:

If IsNull(Me.txtImageLocation) Or Me.txtImageLocation = "" Then
    Me.imgRecordImage.Picture = ""
Else
    Me.imgRecordImage.Picture = Me.txtImageLocation
End If

But the problem is, even though the records all have different pictures indicated in the txtImageLocation, it is showing all the same pictures on each record (shows first record's picture on all).  How do I fix this?

See attached photo.
ee-duplicatephotos.jpg
0
Comment
Question by:gcgcit
  • 5
  • 2
  • 2
  • +1
10 Comments
 
LVL 13

Expert Comment

by:lee555J5
ID: 34933022
Why is the image control in a subform? Can you have multiple images per person record? Without seeing your db, I would have txtImageLocation and imgRecordImage on the main form, not the subform. Can you clarify?

Lee
0
 

Author Comment

by:gcgcit
ID: 34933176
The main form is "department" and then the subform shows all the people in that department.  Each person's record has a picture associated to it.  
0
 
LVL 31

Expert Comment

by:Helen_Feddema
ID: 34933259
Can you post the database?
0
 

Author Comment

by:gcgcit
ID: 34933441
If you are assigning a value on a subform, how do you do this without affecting all records?  Should it be on an event of the control and not the form itself?
0
 
LVL 13

Expert Comment

by:lee555J5
ID: 34935658
The main form is "department" and then the subform shows all the people in that department.  Each person's record has a picture associated to it.
Where is txtImageLocation, on the main or sub form?

Lee
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 84
ID: 34937208
The only way to show different images on a continuous subform is to use a Bound Image control and store the images in your database, which is a bad idea with Access (leads to bloating and corruption).

You didn't say what version you're using, but if you're working with 2007/2010 you can use the Attachment datatype and the Attachment control. Items stored in an Attachment field are acutally stored in the database, so you may be able to do this.
0
 

Author Comment

by:gcgcit
ID: 34943023
I'm using 2003.
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 34943697
Then you're pretty well stuck. You _can_ load the images into the database, but as stated earlier it's not the best solution.

You COULD include the Image control on the Parent form, and then set the Picture property of that as you cycle thorugh the various subform records. To do that, you'd run code like this in your subform's Current event:

Me.Parent.YourImageControl.Picture = Me.txtImageLocation

This will show the picture for the record you're reviewing in the subform.

There's also this:

DBPix: http://www.ammara.com/

I don't know if it will work on a continuous subform, but you might give them a contact to see. I don't use it, but many Access devs do and swear by it.
0
 

Author Comment

by:gcgcit
ID: 34944531
I'm going to try upgrading to Access 2010.  LSMConsulting - can you provide a source or example of how attach datatype would work to display photos on subforms?
0
 

Author Closing Comment

by:gcgcit
ID: 34954044
I'll contact that company or upgrade, thanks for the advice.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now