Results 1 to 10 of 10
  1. #1
    Star Lounger
    Join Date
    Dec 2009
    Location
    Spokane, WA, USA
    Posts
    56
    Thanks
    4
    Thanked 2 Times in 2 Posts

    Displaying Images in Access 2010

    I have set up an inventory database. I want to display a picture of each item in the database.

    In the table where I entered all the fields and other properties, the field is titled "Pictures" and the Data Type is set as "OLE Object".

    On the form where I input the data, I have the same field. It currently displays an icon where the image should be.

    When I click on the icon, it opens the picture in the default Windows Picture Viewer - which displays correctly.

    Once I close the Windows Picture Viewer, the box where the icon is displayed greys out with a series of small dots.

    When I close the form, Access displays the following error:

    You can't save this record at this time.

    Microsoft Access may have encountered an error while trying to save a record.
    If you close this object now, the data changes will be lost.
    Do you want to close the database object anyway?
    Note: I was not trying to change any data; just view the image!

    I'm thinking either the field type in the database table (where the fields are defined) or the field properties on the form are wrong.

    What should I be using for ALL the entries - both in the database table AND the form?

    Thanks,

    Paul

  2. #2
    Star Lounger
    Join Date
    Dec 2009
    Location
    Findlay, Ohio
    Posts
    57
    Thanks
    4
    Thanked 6 Times in 6 Posts
    I display images from .jpg files in a form in same directory (or any directory for that matter) of accdb.
    Selection type is image, name is call pic1
    Me![pic1].Picture = EquipPath & EquipPic << image is jpg

  3. #3
    Star Lounger
    Join Date
    Dec 2009
    Location
    Spokane, WA, USA
    Posts
    56
    Thanks
    4
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by orangehat View Post
    I display images from .jpg files in a form in same directory (or any directory for that matter) of accdb.
    Selection type is image, name is call pic1
    Me![pic1].Picture = EquipPath & EquipPic << image is jpg
    Sorry, I don't understand what your posted.
    I'm not a VB(?) person.

  4. #4
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts
    First, is your database in the .mdb format or the .accdb format? There are several ways of handling images in Access, and it is dependant on those factors. In the .mdb format, it is generally recommended that images be stored externally to the database, and simply linked to from the form. The reason is that Access stores a .bmp version of the image in addition to the original, so the database bloats (gets large) quickly. In the .accdb format there are some changes that make it more practical to store images internally, but they typically involve using VBA code, and the attachment object type. In the .mdb format, this old (but still appropriate) support article How to display images from a folder... has some detailed information on the subject, but it does get into VBA pretty quickly.

    As to what is happening with your current setup, I suspect the Access form thinks the image has changed because you opened it in the picture viewer, and tries to save it, but fails. You might try a simple VBA statement on the form to set the dirty property of the control to false in the Close event of the form. Hope this helps.
    Wendell

  5. #5
    Star Lounger
    Join Date
    Dec 2009
    Location
    Spokane, WA, USA
    Posts
    56
    Thanks
    4
    Thanked 2 Times in 2 Posts
    Thanks for the information!

    The database is in .accdb format.

    On the table where I have defined the fields, here's my settings:

    Field Name: Pictures (Access would not allow my to use the field name of 'images').
    Data type: OLE Object
    Caption: image(s) - some records will have more than one picture. Haven't figured out how to do that yet.
    Required: No
    Text Align: Center

    Some thing I need to note is when I set the table to "datasheet" view, in this field I see "Package".

    On what I call the data input form, I have the following properties for this field (most of these are defaults as they were set by Access). I left out a lot of the fields - especially those I did not change from the Access default.

    The "Selection Type" is 'Bound Object Type'.

    Name: Pictures
    Control Source: Pictures
    Visible: Yes
    Size Mode: Zoom
    Display When: Always
    OLE Type Allowed: Either
    Display type: Content
    Enabled: Yes
    Locked: No
    Auto Activate: Double-Click

    The database is in the following folder: N:\Trains\Inventory\Train Inventory Database
    The pictures are in the following folder: N:\Trains\Pictures\Mine

    I placed the first couple pictures in the table (in datasheet view) and used the following settings:

    Right click - Select "Insert Object".

    It's at this step where I think I'm messing up by using the wrong settings.
    Options are: 'Create New' or 'Create File'; I select 'Create from File' since that gives me a link to browse to the picture folder.
    I did not click on 'Link' or "Display as Icon".
    I browse to the folder and click on the picture.
    I then see the file link and verify it is to the correct picture. Note: Most pictures are .jpg, but a few are .bmp.
    I click on OK.
    As stated above, the word 'Package' now appears in the field in the table.

    When I open the form, the field contains the standard Windows picture the standard Windows picture icon (not the image I would like to see) with the name of the picture.
    When I double-left-click on the icon, it opens using the default Windows Picture Viewer. It displays correctly.
    Once I close the picture viewer, that's when the area surrounding the icon changes to a pattern of closely spaced dots (apparently indicating some type of problem). The dots are over the entire space allowed for the image, including over the icon and the name of the picture.

    Hope all the above helps,

    Paul

  6. #6
    Star Lounger
    Join Date
    Dec 2009
    Location
    Spokane, WA, USA
    Posts
    56
    Thanks
    4
    Thanked 2 Times in 2 Posts
    GOOD NEWS TO REPORT! I figured out how to do this in a way even I understand!

    Followed the guidance in this Microsoft article: https://support.office.com/en-us/art...D-374BCA2E6B40

    In the database table I had to create a field of the type "Attachment". Once that was done I opened the table in datasheet view and for each picture I wanted as part of the record, I had to manually add it. But it was quite simple!

    Then I had to create the field on my data input form.

    It's done - at least for the first 4 records.

    The interesting part will be how the form works when a record has more than one image.

    I'll report back once I get to a record that has more than one picture/image.

  7. The Following User Says Thank You to paulp575 For This Useful Post:

    access-mdb (2016-10-30)

  8. #7
    Star Lounger
    Join Date
    Dec 2009
    Location
    Spokane, WA, USA
    Posts
    56
    Thanks
    4
    Thanked 2 Times in 2 Posts
    Attaching two pictures - the database only shows one. No type of scroll bars or anything to indicate there is more than one image.

    Anyone know of a way to display more than one image in a form - or at least a way to indicate there are more than one image?

    Thanks,

    Paul

  9. #8
    4 Star Lounger
    Join Date
    Jan 2010
    Location
    Fort McMurray, Alberta, Canada
    Posts
    561
    Thanks
    51
    Thanked 68 Times in 66 Posts
    I've never implemented images in a database... but I do know some of the foibles of image viewers.

    Are you sure it is Windows Picture Viewer and not the Microsoft Office 2010 Picture Manager? If it is the latter, this product has a "weird" interface choice. You don't get scroll bars, instead there is a (tiny!) Forward/Backward control. It sits at the bottom of the screen right in the center and looks like two angle brackets. I frequently get baffled when this comes up until I remember this oddity.

  10. #9
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts
    The Microsoft article that you found has a section that indicates that you can click on the attachment control in your form, and you should then get a "Mini-toolbar" that appears and it has scroll bars to go backward and forward.
    Wendell

  11. The Following User Says Thank You to WendellB For This Useful Post:

    paulp575 (2016-11-01)

  12. #10
    Star Lounger
    Join Date
    Dec 2009
    Location
    Spokane, WA, USA
    Posts
    56
    Thanks
    4
    Thanked 2 Times in 2 Posts
    I does! I have to pause for a second or 2 over the image box and the mini-toolbar with three icons appeared - so it is working satisfactorily.

    Thanks to all for all your help ion this.

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
  •