How to import ole fields to a SQL Server db

R

Roberto Cerulli

Hi, I have an access db. In a table I have an ole field where I have lots
of Word Docs stored.
I need to pass all the Access database data to a new SQL Server database,
but I have a problem, the word docs... It seems that Access put an header to
the docs stored in its ole field, but I can't find it.
Anyone can help me?
Thank you in advance
Roberto Cerulli
 
J

John Nurick

Hi Roberto,

Yes, documents stored in an Access OLE field don't consist just of the
contents of the file but also include a wrapper with information about
the parent application of the document and usually a preview image.

I don't know any way of stripping the file contents out of the wrapper
other than by saving it back to disk (from where you would import it to
the SQL server blob field).

For Word documents the only way I know of doing this is to automate an
Access form containing a ObjectFrame control bound to the OLE field to
fire up Word, activate the embedded document and Save As. (For bitmaps,
Stephen Lebans has written procedures to do this much more elegantly:
www.lebans.com.) It would probably be worth searching at
http://groups.google.com/advanced_group_search in case there is a better
way.
 
R

Roberto Cerulli

Hi John,
Thank you, I used the same routine used by lebans, adapted for word docs:
I get the recordset, then for each record I pass the ole field word doc to
an OLE control Bound. Then I copy the OLE Control Bound content, open a new
word document, paste into it what I have copied and save the document with
the save as using the id of the record as the namen of the doc.
I have a problem, it copy only the first page of the document so I loose the
other pages. Do you know why?
Thank you,
Roberto Cerulli
 
J

John Nurick

Hi Roberto,

Do the Word documents you create this way contain the first page of the
document, or *a picture of the first page*?

As far as I know you have to actually activate the OLE object - in this
case the embedded Word document - by manipulating (via VBA code) the
Verb and Action properties of the ObjectFrame control. E.g. set Verb to
acOLEVerbOpen and then Action to acOLEActivate. This opens the embedded
document in Word, and saving to disk will then produce a normal Word
file of the embedded document.


Hi John,
Thank you, I used the same routine used by lebans, adapted for word docs:
I get the recordset, then for each record I pass the ole field word doc to
an OLE control Bound. Then I copy the OLE Control Bound content, open a new
word document, paste into it what I have copied and save the document with
the save as using the id of the record as the namen of the doc.
I have a problem, it copy only the first page of the document so I loose the
other pages. Do you know why?
Thank you,
Roberto Cerulli
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top