Solved

Insert OLE object into Access database via VB

Posted on 2010-08-13
10
1,835 Views
Last Modified: 2013-12-25
Hi,

I follow the following article:

http://support.microsoft.com/kb/210486

to insert a JPEG file to a OLE field.

However, when I try to open the OLE field by double-clicking the field, I get the following error message(attached in this question).

Please help!




error.jpg
0
Comment
Question by:chcw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 4

Expert Comment

by:stevepicks
ID: 33427548
maybe you need to install
 Microsoft Photo Editor
see more at
http://support.microsoft.com/default.aspx?scid=kb;en-us;832508&Product=a

However it would be better-faster for your data, not to store the images inside the table as OLE objects, you can store the image as file paths and uplod them to your server and later present them from their paths.
0
 
LVL 8

Author Comment

by:chcw
ID: 33427582
I am testing a database with OLE object field, so I have to use OLE field to store objects, instead of just storing the file path.
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 33437493
Hi
I'm afraid you're combining incompatible methodologies.
The MS article you highlight is for the insertion (and extraction) of BLOB data from an OLE field. This is a comparatively manual process (in that you're handling the data operations in code - rather than relying on Access functionality).
You can't then switch, and double click the field to have Access launch it as if it were an Access inserted OLE object.
(Hence the error message).
It's a bunch of BLOB data without the binary padding that Access inserts to allow it to use it natively upon demand (and maintain a thumbnail of the file for onscreen representation).

Use the other function on that page to extract the file again to your HD (albeit temporarily perhaps) and launch that file.
(There's a BLOB demo in the examples page linked to in my profile).
Alternatively revert back to the (bloated) method of OLE object insertion.
http://support.microsoft.com/kb/114214
Don't forget to consider the advice from stevepicks regarding storing only links to the original file. (Or a copy of it - whatever is required.)
Cheers,
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Author Comment

by:chcw
ID: 33442757
Hi,

I checked http://support.microsoft.com/kb/114214, but it is only used to link an object in the form. If I do not have a visible form but only want to insert an external file as an OLE which can be opened by double-clicking it, then how to do so?

Thanks

0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 33445550
There are two examples on that page. One linking, the other for embedding.
0
 
LVL 8

Author Comment

by:chcw
ID: 33460541
I checked it, it only works for object frame in Access(I don't know what is an object frame). But I need to use Visual Basic to insert the OLE object directly via DAO or other data engines, not via Access or VBA.
0
 
LVL 44

Accepted Solution

by:
Leigh Purvis earned 500 total points
ID: 33463151
Yeah... if you're wanting to insert Access OLE Objects in VB then you're out of luck.
It would require knowing the exact binary wrapping that Access inserts around the BLOB data of the object itself.
You need the Access control.
It's entirely Access specific functionality.
If you're doing this in VB then use an third party image tool, or work with BLOBs as you were earlier. (But you'll have to manually code the extraction of the BLOB when you double click your picture control.)
0
 
LVL 8

Author Comment

by:chcw
ID: 33464920
Is it possible to insert a word document or Excel spreadsheet with the BLOB method via VB and I can double-click to load the embeded object?
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 33465214
The double click would be just running your own manual code though - yeah?
You're not in Access (you're in VB) and so the OLE Object control isn't there to help you out.
So it's all your own code.
But yes, you can insert any file type as a BLOB.
Cheers.
0
 
LVL 8

Author Closing Comment

by:chcw
ID: 33583023
Thanks
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

724 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