Solved

Insert OLE object into Access database via VB

Posted on 2010-08-13
10
1,795 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
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.

 
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

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
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…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

726 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