Solved

Duplicate Photos on Subform.

Posted on 2011-02-19
10
902 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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
 
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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

856 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