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?
LVL 2
joshldAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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:
http://www.helenfeddema.com/Files/accarch188.zip
Access-2007-Attachments.jpg
0
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.
0
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
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MeridianAssetServicesCommented:
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

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.