?
Solved

Insert OLE object into Access database via VB

Posted on 2010-08-13
10
Medium Priority
?
1,863 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
Industry Leaders: 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month12 days, 21 hours left to enroll

777 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