?
Solved

read "Ole Object Field " by vba in access 2007

Posted on 2011-09-17
6
Medium Priority
?
631 Views
Last Modified: 2012-05-12
I am using the following lines to store file in Access 2007 Ole Object Field

Dim db As Database
Set db = CurrentDb
Dim rs As Recordset
Set rs = db.OpenRecordset("SELECT * FROM Table1 WHERE Id=3")
Dim stm As New ADODB.Stream
stm.Type = adTypeBinary
stm.Open
stm.LoadFromFile "D:\data\swap\aa.txt"
rs.AddNew
rs.Fields("oo").Value = stm.Read
rs.Update
rs.Close

Now my question is how to read that field value and save that stored file in local pc. I am using VBA in access as you see above. Please help
0
Comment
Question by:Amitava_Mukherjee
[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
  • 3
  • 2
6 Comments
 
LVL 85
ID: 36553662
What do you mean by "save that stored file in local pc". Do you have a standard .txt file stored, and you want to output that to the local file system?

0
 

Author Comment

by:Amitava_Mukherjee
ID: 36553732
LSMConsulting:

yes, i have stored a txt file in that field. Now i want to restore that file from the database to my "C" drive

thanx
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36555398
Let's be clear...
You have stored this text file as a stream into an OLE field....
Then what is missing here is what this file is supposed to be once it is stored in the OLE field...?
For example, this text file might be an encoded image (UUencode), ...and once read in as a string, this text file might then become the actual image.
...or it could just be  a simple text file...

So we need to be clear on what this text file is supposed to be once stored in the OLE field.

In any event...

I think you then want this to save the OLE object to a file on the disk:
http://www.lebans.com/oletodisk.htm


JeffCoachman
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

Author Comment

by:Amitava_Mukherjee
ID: 36573066
boag2000:

It is using a custom made dll. I am not comfortable to use any third party dll. Any code is welcome without any custom dll or controls.

Thanx
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 2000 total points
ID: 36575080
<I am not comfortable to use any third party dll.>
Can I ask why?, it is free and it does what you are asking...
It is effectively the same as if you "Getting the code" and "Encapsulated" (for lack of a better word) it yourself.

...Then you may be out of luck here, this the only product I know of that will do this...
Try contacting Mr Lebans directly.
He states that he will no longer update these utilities, but ask if he would be willing to release the source code.

You can do some deep Googling if you like...
But the code to do this is fairly complex, and I doubt that someone would write code that just does this for MS Access, and post it to the web.
(This is in effect what the Lebans utility does...)
...but again, you can try...

I personally prefer not to reinvent the wheel...


JeffCoachman
0
 

Author Closing Comment

by:Amitava_Mukherjee
ID: 36714482
thanx
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

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…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

718 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