read "Ole Object Field " by vba in access 2007

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.LoadFromFile "D:\data\swap\aa.txt"
rs.Fields("oo").Value = stm.Read

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
Who is Participating?
Jeffrey CoachmanMIS LiasonCommented:
<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...

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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?

Amitava_MukherjeeAuthor Commented:

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

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Jeffrey CoachmanMIS LiasonCommented:
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:

Amitava_MukherjeeAuthor Commented:

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.

Amitava_MukherjeeAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.