Results 1 to 8 of 8
  1. #1
    jker is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Aug 2023
    Posts
    36

    need help with image/attachment in access 2007 form

    1- i have PRODUCT table defined with Product_number, product_name,Product_image
    2- PRODUCT_IMAGE is defined in table as ATTACHMENT


    3- I have a form where the user selects from a Combo box list , the product_name
    3a- forma contains 2 text boxes, for PRODUCT_NAME, PRODUCT_NUMBER and an ATTACHMENT box intended for the PRODUCT_IMAGE
    4- My combox box list is based on a SELECT that contains the product_number, product_name and product_image
    5- when user selects the product, my text boxes are populating with the product_number and Product_name



    PROBLEM: my PRODUCT_IMAGE is not loading onto my form

    question: HOW DO I POPULATE AN IMAGE/ATTACHMENT FROM A COMBOBOX LIST: (PLEASE SEE THE JPG ATTACHMENTS)Click image for larger version. 

Name:	DESIGNVIEW.JPG 
Views:	29 
Size:	59.7 KB 
ID:	50905Click image for larger version. 

Name:	FORMVIEW.JPG 
Views:	29 
Size:	30.4 KB 
ID:	50906

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Not recommended to have attachments, they will bloat your DB quickly if too many.
    I have attached Northwind 2007 version which has those. Look to see how they do it on the Employee form.

    Site is not allowing Chrome again to upload files.
    I will be back with Firefox in a minute.

    File is too big, even zipped, so you will have to look for it yourself.
    https://www.google.com/search?q=nort...hrome&ie=UTF-8

    Basically it appears to just have a bound control to the attachment field.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    As WGasman points out, it's usually a bad idea to use the attachment fields.

    Better to just store the path to the image in your database rather than the image itself.

    There are a few different ways to populate the image control.
    One being set the picture property of the control

    Code:
    Me.Image1.Picture = "C:\somefolder\somePicture.jpg"
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    And ControlSource property. Review https://www.accessforums.net/showthread.php?t=73766
    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
    jker is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Aug 2023
    Posts
    36
    If i use your suggestion, then how do i get the image to appear on the screen instead of the file and pathname?

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Did you review the thread link I posted? You set the ControlSource property of an Image control, not a textbox.
    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
    jker is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Aug 2023
    Posts
    36
    I solved my problem:
    1- added TEXT column to my table that contained the image path name for each product
    2- added two fields to my form a- text filed that contains the image path name b- image control
    3 bound both objects to the same CONTROLSOURCE

  8. #8
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    I think June7 did that for you?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. Form will not display image attachment from subform
    By standonthefloor in forum Forms
    Replies: 2
    Last Post: 03-05-2019, 09:58 AM
  2. Form Attachment Default Image Cut Off
    By breakingme10 in forum Forms
    Replies: 2
    Last Post: 06-06-2014, 12:45 PM
  3. Replies: 4
    Last Post: 11-26-2013, 02:35 PM
  4. Access 2007 Form Image Location
    By trb5016 in forum Access
    Replies: 0
    Last Post: 07-08-2010, 08:04 AM
  5. Attachment help in sub-form in Access 2007
    By turnertj in forum Forms
    Replies: 1
    Last Post: 06-28-2010, 01:40 PM

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