Link to home
Start Free TrialLog in
Avatar of Ryan Huggins
Ryan HugginsFlag for United States of America

asked on

Saving a bitmap as a bitmap in an Access 2000 OLEObject field using VB6 SP5

I am, for a class project, trying to create a data-entry program in VB6.  The problem I'm having is that when I try to save a bitmap in the database it saves as a "Long Binary Data" as opposed to a "bitmap".  Is there anyway to insert the bitmap as a bitmap?

I have also tried to create an Access 2000 form to do the same (using VBA), but with no success.

Is there anyway to insert a bitmap as a bitmap into an OLEObject field in any of these programs?

  Thank you,

     Ryan Huggins
Avatar of nico5038
nico5038
Flag of Netherlands image

When you insert an OLE object, you can store an image in this. However, this might "bloat" the database.
Normally we store just the path and filename in a text field and then show that using an image control.

The Northwind database has a sample of images stored by the products.
Inserting an object in the OLE can be done by double-clickng on the object.

More info needed?

Nic;o)
Avatar of pkolbus
pkolbus

Ryan,

I had a similar project back in the days of VB3 and Access 1.1.  We stored the picture data in a Memo field in the database.  I have the original project, if you're interested let me know.

Peter
Avatar of Jim Dettman (EE MVE)
Ryan,

Take a look at the following MSKB article:

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q210486

  which contains the functions WriteBlob and ReadBlob.  Using these, you can store any type of binary data in a OLE field without Access wrapping anything around it.

Good luck with your project,
Jim.
Avatar of Ryan Huggins

ASKER

Nico - I have a question.  I have looked at the Northwind database, and aside from clicking the next record button, I can't see how they acutally save the image.  I'm looking for something along the lines of actual code, if there is any.  Thanks.

Jim- Thanks for the article.  I have followed the instructions verbatim, but I keep getting a "Long binary data" type.  Any ideas?

Peter- Thanks.  I am definetly interested in looking at your original project.  If you could, please send it to Ryan.Huggins@Verizon.Net
Nico - I have a question.  I have looked at the Northwind database, and aside from clicking the next record button, I can't see how they acutally save the image.  I'm looking for something along the lines of actual code, if there is any.  Thanks.

Jim- Thanks for the article.  I have followed the instructions verbatim, but I keep getting a "Long binary data" type.  Any ideas?

Peter- Thanks.  I am definetly interested in looking at your original project.  If you could, please send it to Ryan.Huggins@Verizon.Net
Ryan,

  Well yes, that's what you will get.  Your storing binary data in a OLE type field, but without the OLE wrapper that Access normally puts on it.  This means that if you double click on the field, nothing will happen has Access does not know how to deal with it.

  If the objective is to actually load the image in the table with the OLE wrapper, then see this MSKB aritcle:

ACC: How to Load OLE Objects from a Folder into a Table (Q158941)

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q158941

  The only way to do this is through a form and the end result is that your database size will increase.  The typical way to deal with images is to store them as seperate files and only store a path/filename in the table.

Jim.
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial