Results 1 to 5 of 5
  1. #1
    Tectu is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    20

    Displaying attached image in form


    Hello folks,

    In my table tblComponents I have a field called Picture which is of the type Attachment. I would like to display the image in a form but I cannot figure out how to do so.
    I am not even sure if I have to use the Attachment, Image or the Object Frame widget.
    Furthermore, I would like to set the image in VBA code as I am working with a RecordSet in there.

    I am thankful for any help.


    ~ Tectu

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    There is a control for Atachment fields that you can add to your forms. Users can interact with the attachments in a table via this control. If you have a bound form, you can use the "Field List" via the Add Existing Fields button within the Ribbon. Dragging the name of the attachment field to your form while in design view is the easiest way to go about it.

    Using VBA to manipulate attachment fields/data types is a whole other animal.

  3. #3
    Tectu is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    20
    Thank you for your answer.
    I am dealing with an unbound form. Is the attachment field/widget supposed to directly display the actual image or will it just list it so the user can double click it? If the field/widget can display the image directly, how do I assign the image through the VBA code?

    Some background: I have something like a products table and I attach an image for each product. In the form I would simply like to see the image along with the other data.
    The reason why I use an unbound form is because I have a listbox widget on the form so the user can navigate through the different products. I use the AfterUpdate event of the listbox to fill in the other fields by using the OpenRecordset() function. Everything works beside that I cannot figure out how to display the picture.


    ~ Tectu

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I usually avoid the attachment field. There are rare instances where it is convenient. However, you will have more control storing files like pictures, word docs, spreadsheets, etc. in a shared folder on the network or a subfolder to the desktop app's directory.

    You can store the path and file name in your table as plain text. With that, you can dynamically update the path of an image control using VBA. There are different types of image controls. The simplest would be to use the Wizard to add a sample image (something that is on your C drive) to a control type called "Image". While in design view of your form, under the Design tab of the Ribbon, click the "Image" control. You will want to ensure that the Wizard is turned on. The wizard will prompt you for a picture file. To make sure the wizard is turned on, click the little "Down Arrow" in the lower left corner of the group of controls and highlight "Use Control Wizards".

    With the wizard turned on and the Image Control button selected/clicked, click your form and the wizard will launch.

    After you add a sample picture to your form, you can use VBA to dynamically update the Picture property of your new Image Control.

  5. #5
    Tectu is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    20
    Thank you for your help.
    For the moment I am now working with a bound form and the attachment field in the form as you suggested in your first post.

    The picture I am storing is really small and has no meaning outside of the database UI. Hence I don't mind having it inside of the database in this case.


    ~ Tectu

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

Similar Threads

  1. send email with attached image in body
    By trevor40 in forum Programming
    Replies: 5
    Last Post: 02-14-2014, 01:17 AM
  2. Replies: 2
    Last Post: 01-07-2013, 05:23 AM
  3. Displaying image in calculated field
    By ceci123 in forum Access
    Replies: 2
    Last Post: 01-25-2011, 11:51 AM
  4. Filename displaying with image
    By Rob Parker in forum Forms
    Replies: 2
    Last Post: 01-13-2010, 05:05 PM
  5. Error displaying image on form
    By mamba716 in forum Forms
    Replies: 6
    Last Post: 06-17-2009, 09:13 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