Results 1 to 8 of 8
  1. #1
    Wilson1218 is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    4

    Help with attachments

    Hello, I have multiple attachments (.png files) in each record of my database, and I was wondering if you could tie a button in a form to the attachments in such a way that pressing a button would display the corresponding image. Example: I have 4 .png attachments in each record. I want to have 4 buttons, where clicking button 1 displays picture 1 in the allocated place in the form (pre-defined in design view), button 2 does the same for picture 2 etc.



    Can anyone help?

    Thanks!

    Wilson

  2. #2
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    Storing attachments in tables is ill advised. An image control with it's path property set to be the location of the image would be better. Then you wouldn't need a button to see it - it would just be there. If that slowed down the form too much (network traffic/speed, image file size, etc. are factors) then I suppose a button or something similar could be used, but how would I know which one to click if I can't see the image?
    Alternatively, there is the OLE bound control (at least I think so - have never used it for images) but that requires the image to be an attachment in a table, which could work if you insist on that approach. As for buttons, I'm not a macro user so I can't say in that regard, but vba code could make the image visible if you're not using one of the other two methods.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Wilson1218 is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    4
    They have to be attachments for other reasons.

    You would know which button because each 'picture 1' across all records has something in common, but I was asking HOW I might do something like that.

    Thanks!

    Wilson

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,643
    Is each image in its own field? An Attachment type field?
    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
    Wilson1218 is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    4
    No, 4 attachments (or sometimes more) in a single attachment field.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,643
    But if you sometimes have more than 4 images, 4 buttons will not be enough.

    An attachment field is a type of multi-value field. AFAIK, addressing the individual items stored in a multi-value field requires expanding the field in a query so each item is a record.

    An Image control bound to an attachment field with multiple images knows how to deal with the multiple images - a navigation bar is associated with the Image control so users can navigate the images. Using code to navigate this control is not something I have explored.
    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
    Wilson1218 is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    4
    Ok, how would I use an image control? I've never heard of it. A navigation bar would work for my purposes.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,643
    Drag the attachment field from the Field List onto form. Should automatically create Image control. Switch to form view. Click on the control and a little navigation bar should appear above the Image control.
    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. Attachments.Add
    By MAAYA in forum Programming
    Replies: 2
    Last Post: 11-21-2017, 08:04 AM
  2. Replies: 2
    Last Post: 01-29-2014, 03:19 PM
  3. Attachments
    By JayX in forum Access
    Replies: 5
    Last Post: 12-27-2011, 03:08 PM
  4. attachments
    By chiefmsb in forum Access
    Replies: 0
    Last Post: 07-10-2011, 07:38 PM
  5. Attachments
    By cjp78 in forum Access
    Replies: 4
    Last Post: 05-11-2010, 07:30 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