Results 1 to 8 of 8
  1. #1
    ZOMB13 is offline Novice
    Windows 8 Access 2007
    Join Date
    Apr 2015
    Posts
    11

    Multiple picture change subform focus


    Hi all,

    Is it possible for an image control to change to a different picture on a form when focus changes to a different record on a subform? I am developing a simple database to record my ever growing collection of TV shows. The form that I use to view my TV show records has an image control on it, I previously had a single image for the entire series (box art for first season). I now want that image control to change to a different picture when the focus changes to a different record on the subform. Ie. when the focus changes from the first season on the subform to the second season; the picture on the main form changes with it. Hope this makes sense. Thanks in advance.

    ZOMB13.

  2. #2
    trevor40's Avatar
    trevor40 is offline Advanced db Manager
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    402
    Yes it is, but i did this so long ago i forget how i did it. but when the record in the sub form changes just update the image on the main menu with the details for the selected record in the sub form. it has to be a full path - c:\aaa\pic.jpg saved in a related field to the show.

  3. #3
    ZOMB13 is offline Novice
    Windows 8 Access 2007
    Join Date
    Apr 2015
    Posts
    11
    I found this http://www.experts-exchange.com/Data..._28269209.html I think that’s what I’m looking to do, but I can’t seem to make it work on my db. Someone must be able to enlighten me?

  4. #4
    ZOMB13 is offline Novice
    Windows 8 Access 2007
    Join Date
    Apr 2015
    Posts
    11
    TVDB.zip Thought I might upload my db so that it’d make it easier to understand what I’m trying to achieve. Thanks.

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Pic_Dynamic_Path.zip
    Here is an example.


    I placed three photos in a subfolder to the DB's path. The subfolder's name is hardcoded in the form's current event. The file names are in their respective records within the table.

    To do this, I create an image control and adjust its PictureType property to Linked. When I create the image control, I use one of the actual pictures that will be used by the DB. This helps with picture sizing. Then, I will change the property to linked. Then, add the VBA.

  6. #6
    ZOMB13 is offline Novice
    Windows 8 Access 2007
    Join Date
    Apr 2015
    Posts
    11
    Quote Originally Posted by ItsMe View Post
    Pic_Dynamic_Path.zip
    Here is an example.


    I placed three photos in a subfolder to the DB's path. The subfolder's name is hardcoded in the form's current event. The file names are in their respective records within the table.

    To do this, I create an image control and adjust its PictureType property to Linked. When I create the image control, I use one of the actual pictures that will be used by the DB. This helps with picture sizing. Then, I will change the property to linked. Then, add the VBA.
    ItsMe,

    Thank you for your response, however I don’t believe that is what I’m trying to achieve (see original post). Take a look at my database that I uploaded, It might make more sense than my ramblings. Thanks,

    ZOMB13.

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Image control has a ControlSource property (starting in Access 2007). The property can be bound to an attachment type field that holds image files or to a text field that has path to external image file. It can even be an expression that concatenates a string with a field - so if that field has only the image name:

    ="C:\path\imagefolder\" & [fieldname]

    I suggest you have image name in the Picture field in SEASONS table, then ControlSource expression like:

    ="driveletter:\path\imagefolder\" & [Seasons subform]![Picture]

    No VBA needed.
    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.

  8. #8
    ZOMB13 is offline Novice
    Windows 8 Access 2007
    Join Date
    Apr 2015
    Posts
    11
    Quote Originally Posted by June7 View Post
    Image control has a ControlSource property (starting in Access 2007). The property can be bound to an attachment type field that holds image files or to a text field that has path to external image file. It can even be an expression that concatenates a string with a field - so if that field has only the image name:

    ="C:\path\imagefolder\" & [fieldname]

    I suggest you have image name in the Picture field in SEASONS table, then ControlSource expression like:

    ="driveletter:\path\imagefolder\" & [Seasons subform]![Picture]

    No VBA needed.
    June7,

    That’s perfect, thanks so much. I feel like such an idiot, that was ridiculously easy. I was so close yet so far. I was referencing the table in the ControlSource of the image control, when I should have been referencing the subform. Thanks again,

    ZOMB13

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

Similar Threads

  1. change focus; disable control
    By markjkubicki in forum Forms
    Replies: 8
    Last Post: 07-30-2013, 10:31 AM
  2. Replies: 6
    Last Post: 05-05-2012, 08:43 AM
  3. Any change of focus on form Event?
    By trb5016 in forum Forms
    Replies: 1
    Last Post: 02-11-2011, 08:25 PM
  4. Change a Picture in an Attachment
    By ksmith in forum Access
    Replies: 2
    Last Post: 08-18-2010, 11:17 AM
  5. Replies: 2
    Last Post: 03-10-2009, 05:14 PM

Tags for this Thread

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