Solved

Duplicate Photos on Subform.

Posted on 2011-02-19
10
915 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

696 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