By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,471 Members | 2,192 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,471 IT Pros & Developers. It's quick & easy.

How to create a copy of object retrieved from bound object frame?

FishVal
Expert 2.5K+
P: 2,653
Hi!

I have a table in my Access 2003 db containing OLE Object field with Word Document. What i want to do is to open an unbound copy of Document in MSWord application so the source in the table will remain intact and changes made to the Document will not be saved in the db.
I've not succeded to open the object through ADO recordset. The only solution seems to me is to access the object through Bound Object Frame control.

So the question is how can I make an independant copy of BoundObjectFrame.Object in order to close the form with source control?

Thanks.
Jun 2 '07 #1
Share this Question
Share on Google+
3 Replies


JConsulting
Expert 100+
P: 603
Hi!

I have a table in my Access 2003 db containing OLE Object field with Word Document. What i want to do is to open an unbound copy of Document in MSWord application so the source in the table will remain intact and changes made to the Document will not be saved in the db.
I've not succeded to open the object through ADO recordset. The only solution seems to me is to access the object through Bound Object Frame control.

So the question is how can I make an independant copy of BoundObjectFrame.Object in order to close the form with source control?

Thanks.
use a click event...if you have the name of your linked Doc..pass it to this function. When it opens, you can make changes all you want then use SaveAs option to save it

Expand|Select|Wrap|Line Numbers
  1. Function CopyDoc(strDoc As String)
  2. Dim wrd As Object
  3. Set wrd = CreateObject("Word.Application")
  4. wrd.Visible = True
  5. wrd.Documents.Open strDoc
  6. End Function
  7.  
J
Jun 2 '07 #2

FishVal
Expert 2.5K+
P: 2,653
Thanks.

I've ment completely the different thing. The solution you've offered I've already used. My intension is to embed Word documents used as report templates into the db and store them in OLEObject table field.
It seems to me impossible to create a corresponding object from OLEObject field accessing table through ADO. By the way, does anybody knows how to do it ?????
The simplest solution to my mind is to create form with BoundObjectFrame control and to access the correponding document through Object property of the control. This has two disadvantages: 1) a changes made to the object will be saved in db, 2) the above mentioned form have to be open throughout the time period one works with the document. This could be overcome by different methods and tricks (e.g. opening the document, saving in temp file and reopening from the temp file etc.). This is problem that could be easily solved.

The question I've asked is more general. Does anybody know how to clone an object in VBA, this means to make a completely independant copy of the object ?????
Jun 2 '07 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
If by an object you mean a file object then this basic function should work.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Function copyOverFile(fromPath As String, toPath As String)
  3. Dim fs As Object
  4.     Set fs = CreateObject("Scripting.FileSystemObject")
  5.     fs.CopyFile fromPath, toPath, True
  6.  
  7. End Function
  8.  
To use this function you have to reference the Microsoft Scripting Runtime library (Scrrun.dll)
Jun 4 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.