Solved

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

Posted on 2002-03-24
7
319 Views
Last Modified: 2013-12-03
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
0
Comment
Question by:mars_g
7 Comments
 
LVL 54

Expert Comment

by:nico5038
ID: 6892747
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)
0
 
LVL 1

Expert Comment

by:pkolbus
ID: 6892970
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
0
 
LVL 57
ID: 6894029
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.
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

Author Comment

by:mars_g
ID: 6898446
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
0
 

Author Comment

by:mars_g
ID: 6898489
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
0
 
LVL 57
ID: 6899093
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.
0
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 200 total points
ID: 6899098
BTW, Sorry I mis-read your original question.  I just re-read it and the answer is no.

The only way to get the OLE wrapper added is through a form.  The wrapper spec has never been documented, so it's impossible to add it via a programatic means.

Jim.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question