Results 1 to 12 of 12
  1. #1
    MrDummy is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Posts
    50

    Show Pictures based on shared ID

    Hello,

    Not sure where to post this question so posting it here.

    In a form I select an object (Container) and then data is shown. Based on the selected object (container) I want to show images. Therefor I have a query that contains the ContainerData ID and a hyperlink to the picture.

    I can create a subform with the ContainerDataID. (I can select the Picture.File.URL, Picture.File.DATA etc and then the ContainerDataID is shown but no picture is shown).



    As you can see from the below picture. One Container can have more than one picture.

    Is there a way to do this?

    Attachment 23187

  2. #2
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    not sure I understand what you are doing but my first response is why a query and not a join with a many to many table?
    try this article
    http://en.tekstenuitleg.net/articles...ship-in-access

  3. #3
    MrDummy is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Posts
    50
    Hello,

    The object (container) contains several other sub-objects (user defined) and based on this content the container must be labeled. Because these sub-object contain double values a query is made to find only the unique values. So based on this query with only unique values the container is labeled with each label only appearing once.

    In this case a many to many relationship will not work

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Your attachment is not working.

    I also don't understand what you are doing. An Image control can dynamically display images from attachment field or by file path reference.

    Your reason for not using a related table doesn't make any sense to me.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    MrDummy is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Posts
    50

    Sample Database.

    Hello,

    I made a sample database for my issue. Explanation is in the database. I hope this makes it a little bit clearer.
    Attached Files Attached Files

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Are these the actual images you will use or are these just surrogates for this example? Don't think I've ever seen queries included in Relationships. tlkpSpecialInfo is not included in any relationship - why?

    fsfrCreateDGM3 does not have a RecordSource that includes the attachment field - how do you expect to display the images? Since the queries are not editable because they involve UNION, possibly need a subform with Image control to display the associated images.

    I was able to create a Continuous form to display images and it works as stand alone and when embedded as subform.

    If the Select Item combobox is for input of filter/search criteria it must be UNBOUND, otherwise will change data in record.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    MrDummy is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Posts
    50
    Thanks. The actual pictures have been removed. The RecordSource disappeared when I removed the "Confidential Info" in the fsfrCreateDGM3; the ContainerDataID is, in the not Confidential Version, in the RecordSource from the qryContainderSeg. So the fsfrCreateDGM3 and the next subform are related with the ContainerDataID.
    I manage to make a subform at the right place however it cannot be a Continuous form. It can only be a datasheet or a Single form. Both showing only the links and not the picture itself.

    So I am curious how you managed to get the subform in that shows all the pictures. Have had a headache for some days now.

    Your remark about the combox is noted

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I did:

    1. created a Continuous form and bound it to Query1 (you can do Single form, datasheet will not show images)

    2. dragged Picture field from the field list to form - this will create an Image control by default

    3. embedded this form as subform on fsfrCreateDGM3, the Master/Child links automatically established
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    MrDummy is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Posts
    50
    Dear June7. Many thanks. This works perfectly.

    Maybe you have an answer to the question: How is the new subform (with the labels) automatically updated when, for example, the BookingRef is updated or newly inserted. I tried several events in the fsfrCreateDGM3 but none led to the subform being updated. Also tried Requery, Recalculate and refresh but no luck so far.

    Again many thanks and wishing all the best for 2016. I know I have one issue less after your useful reply.

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    BookingRef is not a PK/FK - it has no bearing on how images are associated with parent record. Neither does the ContainerNumber. The PK/FK fields are ContainerDataID and Class/Label1DGM. Why would you expect changing BookingRef or ContainerNumber to change the labels?


    No relation to above issue, but suggest change in qryLabelsContainer.

    SELECT DISTINCT tblLabelsDGM.ContainerDataID, tblLabelsDGM.LabelDGM
    FROM (SELECT [ContainerDataID], [Label1DGM] AS LabelDGM FROM qryContainerSeg
    UN ION SELECT [ContainerDataID], [Label2DGM] FROM qryContainerSeg
    UN ION SELECT [ContainerDataID],[Label3DGM] FROM qryContainerSeg) AS tblLabelsDGM
    WHERE (((tblLabelsDGM.LabelDGM)>""))
    ORDER BY tblLabelsDGM.ContainerDataID;
    Last edited by June7; 12-31-2015 at 11:53 AM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    MrDummy is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Posts
    50
    Hello, Indeed the Booking Ref and Container number are not directly related to the labels. But in the end the labels must be placed on the container. In fact the contents of the Container is a selection from the tlkpMainData made by the user (this form is not in the Sample Database, but is normally placed below the Container Number box). The selection is stored in the tblUNComplete. For the simplicity these are now similar. Based on this selection (where multiple values for the labels can exist or double values may arise) the final labels for the single Container are created using the earlier discussed Queries. And this works perfectly!!!
    Reason why I mentioned the Booking ref/Container number is that the user selection subform is not in the Sample DataBase but the issue to be solved, at least that’s how it seems to me, is similar.

    The problem to be solved is that when the user selection is updated, entries are deleted or when a new entry is made the new subform for the labels also needs to be updated.

  12. #12
    MrDummy is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Posts
    50
    June7. Many with some tweaking managed to update the form.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 15
    Last Post: 11-13-2014, 09:07 AM
  2. Replies: 1
    Last Post: 12-15-2012, 12:46 AM
  3. Replies: 6
    Last Post: 04-23-2012, 10:54 AM
  4. Replies: 1
    Last Post: 06-12-2011, 07:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums