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

    need help with COMBO BOX populating ATTACHMENT box

    in my form i have a combobox that contains TxtProductId, TxtName, TxtCost and an image (defined as attachment in the table design)

    what i want to is every time i select the product from the combo box, to load the corresponding image.



    this is my code:



    What is happening is that the image is not being loaded into the box (defined as attachment) on my form

    Private Sub CbxProductList_Click()
    '************************************************* ****
    '** populate screen from value selected in combox list
    '************************************************* ****
    TxtProductId = CbxProductList.Column(0)
    TxtName = CbxProductList,column(1)
    Txtcost = CbxProductList.Column(2)


    TXTpRODUCTiMAGE = CbxProductList.Column(3)
    end sub

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    What is in column 3? A path/file name? Something else?

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Load image from where - a folder location?

    Can't save file into Attachment type field like that. Attachment field is a multi-value field. Review

    https://stackoverflow.com/questions/...ltivalue-field

    If you are trying to pull image from Attachment field for display, can't do it they way you are attempting.
    Working with Attachment Fields - MS-Access Tutorial (sourcedaddy.com)

    Also review https://www.accessforums.net/showthread.php?t=73766

    Exactly what is this box you are trying to load an object into?
    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.

  4. #4
    moke123's Avatar
    moke123 is online now Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    Most developers avoid attachment fields as they tend to bloat the size of your database.

    Use a separate folder of images and either store the name of the image or store the full path to the image as text in a field.

    You then use an image control on your form and set its picture property in the after update of the combobox. If you store the full path you could also bind the image control to that field in the table.

    Here's an example which just stores the name of the image and a function to point to the image folder. (the folder must be in the same folder as the accdb for the function.)
    Attached Files Attached Files
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  5. #5
    jker is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Aug 2023
    Posts
    36
    Quote Originally Posted by CJ_London View Post
    What is in column 3? A path/file name? Something else?

    Column 3 is the 4th item in my select statement that i use to populate the combo box list. but i set my combox box up so that the user only sees the first 3 colomuns

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    That still doesn't clarify what the 4th column contains. You state in your original post "...and an image (defined as attachment in the table design)..." which sounds like an Attachment data type field. Regardless of field type, what you tried won't work. Did any of the links or moke's db help you?

    If you want to provide db for analysis, follow instructions at bottom of my post.

    Last edited by June7; 10-07-2023 at 07:22 PM.
    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
    moke123's Avatar
    moke123 is online now Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    Column 3 is the 4th item in my select statement that i use to populate the combo box list.
    show us the select statement.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

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

Similar Threads

  1. Replies: 5
    Last Post: 05-01-2017, 06:17 AM
  2. Replies: 1
    Last Post: 09-16-2013, 02:37 PM
  3. Replies: 2
    Last Post: 08-16-2012, 10:02 PM
  4. COMBO BOX Populating
    By b123 in forum Forms
    Replies: 14
    Last Post: 10-13-2010, 03:34 PM
  5. Populating attachment field based on text box
    By justinwright in forum Forms
    Replies: 16
    Last Post: 09-22-2010, 08:38 AM

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