Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Having problems inserting a photo into a table Expand / Collapse
Posted Saturday, February 4, 2012 10:11 AM

SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: 2 days ago @ 7:48 PM
Points: 206, Visits: 486
My dad has MS Access 2007 on his PC. I've got it on one of my desktops. He called me up, asking how to insert an image into a field of an Access table. Frankly, I've never done that, but whipped up a simple table, with an indentify (autonumber) field and an OLE Object field, and tried to insert images. I found that if I choose .jpg files, they got inserted into the field with a label of "Package", but if I inserted a .bmp file it got inserted into the field as a "Bitmap Image". More importantly, when I generated a quick report against that table, all of the "Package" items appear as broken images, but all of the "Bitmap Image" records had images in the report. So, clearly it looks to me as though they have to be .bmp files. I told my dad that, and he went and tried to do that. However, he claims that all of them get inserted as "Package", so none of them look right in reports.

Why? What's he doing wrong? Is there some configuration setting he needs to take care of?

Post #1246921
Posted Saturday, February 4, 2012 11:02 AM


Group: General Forum Members
Last Login: Today @ 5:50 AM
Points: 196, Visits: 781
This turns out to be a complicated subject. The first question is whether he is using the old .mdb format for his database, or whether he is using the new .accdb format? In the .mdb format, storing photoin an Access table is problematic if you have more than a few to store, as the database will grow by a significant amount for each photo. Access actually stores both the original .jpg as well as a .bmp format image. The usual solution to that is to store a link that gives the path and file name of the image and to dynamically load that information into an image control on a form when you want to view it.

If he is using the new .accdb format, it still supports the old approach, but adds a new kind of field type called Attachment. This Microsoft Support Article goes into a fair bit of depth on how to use that type. However you should be aware that there have been some issues with that field type in early versions of 2007, so make sure your Dad has SP2 installed.

Colorful Colorado
You can't see the view if you don't climb the mountain!
Post #1246923
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse