[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 865
  • Last Modified:

Access 2007 attachments and Images

I want to be able to on a form from access call up an attachment based on what the user selects from a combo box. The attachment will be a picture from an attachment from a table.

Can I do that from the control source of a image or do I have to do this from VBA? If so how?
1 Solution
Helen FeddemaCommented:
What exactly do you mean by "call up an image"?  You might be able to just store the images in the new Attachment type field, and then users can open them by right-clicking and selecting Open from the dialog (see below).
Here is a link for my Access Archon article on Access 2007 Attachment fields:
joshldAuthor Commented:
I have a form that the user will select several options then from those option I want to display the correct that is attached in a table. So Based on what the user selects, I need to pull that image from the table and display it in the form. I cant have the user select the image, the image will be automatically select based on what the user selects from a combination box.
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
If you simply want to display an image, then don't store them in a table. Instead, store them on disc, and use an Image control on your form to show the picture. You can store the physical file path to those images, and then just set the .Picture property of your Image control in the Current event of your form - or store that filepath with your record, if that makes more sense:

Sub Form_Current()
  Me.MyImage.Picture = "Full path to the image"
End Sub

Or if it should be dynamic:

Sub Form_Current()
  Select Case Me.SomeField
    Case "Red"
      Me.MyImage.Picture = "Full path to Red image"
    Case "Blue"
      Me.MyImage.Picture = "Full path to Blue image"
    Case Else
  End Select
I searched for days how to call the attachment from a combobox and still was not successfull. Thanks for the post on using images instead.  It's not ideal but it will work in this case.  I am using a file path and a string to call the image in case anyone is interested.  Of course, user has to have the picture saved in the folder and named the same as the value in the combobox, and the image has to be a .jpg (Not ideal)

Private Sub Name1_AfterUpdate()
Me.Image1.Picture = "\\full file path\" & Name1.Column(0) & ".jpg"
End Sub

Open in new window


Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now