Results 1 to 4 of 4
  1. #1
    jessehiggins is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    2

    Change an image on a form based on a combobox

    I have searched and searched and cant find exactly what I need so I'm hoping someone can help.



    I am creating a employee database, I have several cascading combo boxes for different selections that take you down to selecting the employee ID. What I would like to do is once the employee ID is selected I want their picture to be displayed. The majority of the employee info is stored in a table called employee details and the pictures are stored in a table called employee files. Both tables contain an employee ID field. The pictures are stored in the table because this file will be used on multiple computers with no shared directories.

    I have been able to find answers for pointing to the path of the picture after the combo box is updated but have not seen any code to pull the picture from another table.

    I hope I have explained this clearly. Any help would be appreciated.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Have to bind Image control to the attachment field. If the images were stored externally, the Image control ControlSource could be an expression for the image path/filename.

    Should join the pictures table to employee details table in a query that is the form RecordSource.
    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.

  3. #3
    jessehiggins is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    2
    So you will have to dumb this down for me a bit.

    I assume I need some code to run in the Event after update on my employee ID combo box that will look for the same EmployeeID either in the EmployeeFiles table or the query and return the EmployeePicture and put it in the Image box on my EmployeeForm. What would that code look like?

    Thanks for the help.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Bind the Image control to the attachment field. Best to drag the attachment field from the Field List of the form to create the bound control.

    Code behind the combobox would be to find the record for the selected employee ID. Code will be involved but varies with options:

    1. dynamic parameterized query (I never do this) - the form RecordSource is a query that has filter parameter referencing the combobox and code will just requery the form
    Me.Requery

    2. construct filter criteria and set the Filter and FilterOn properties of form
    Me.Filter = "EmployeeID=" & Me.comboboxname
    Me.FilterOn = True

    3. instead of filtering form recordset, move to the desired record - the VBA is a bit more complicated
    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.

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

Similar Threads

  1. change image based on combo box selection
    By cpotter in forum Database Design
    Replies: 11
    Last Post: 10-05-2013, 09:51 AM
  2. Change fields based on a combobox click
    By Richie27 in forum Programming
    Replies: 5
    Last Post: 05-31-2012, 08:01 AM
  3. Display image based on combobox selection?
    By 10 Gauge in forum Forms
    Replies: 2
    Last Post: 09-15-2011, 07:42 AM
  4. Replies: 0
    Last Post: 08-24-2010, 06:38 PM
  5. Image change based on combo box
    By bosve73 in forum Forms
    Replies: 4
    Last Post: 08-09-2010, 02:23 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