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
Author
Message
Posted Saturday, February 04, 2012 10:11 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, March 28, 2014 8:27 AM
Points: 119, Visits: 311
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?



Rod
Post #1246921
Posted Saturday, February 04, 2012 11:02 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Yesterday @ 6:41 AM
Points: 139, Visits: 509
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.


Wendell
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