Can I open an imbedded word doc from a cmd button?

J

Joe M.

I would like to imbed a word doc in my db (in a form?) and open it with a cmd
button (like a help document). Is this possible and if it is how is this done?

Many thanks,
Joe M.
 
F

fredg

I would like to imbed a word doc in my db (in a form?) and open it with a cmd
button (like a help document). Is this possible and if it is how is this done?

Many thanks,
Joe M.

Why do you need to embed a document in your database?
Store the document in a folder on your hard drive.
Then open it from a command button whenever you wish, using:

Application.FollowHyperlink "C\PathToFolder\MyDocName.doc"
 
J

Joe M.

I would like to imbed the doc because I dont want to worry about changing the
path if the db gets moved. If it can be imbedded then the db and doc always
stay together.

Thanks,
Joe M.
 
P

Paul Shapiro

It's been a while since I've done this, but I think all you need to do is
include that field in a bound object control on a form. Set the OLE Type
Allowed to Embedded, set Class to Word.Document (you might need to include
the Word version but try without first), Update Options = Automatic, Display
= Content. Double-clicking that control on an existing document should then
open the document in Word. Adding a few lines of code in the OnDoubleClick
event will create a new Word document if nothing is stored in that field
yet. Substitute the name of your bound object control for
"objConfirmationLetterWord" in this sample code.

If IsNull(Me.objConfirmationLetterWord) Then
With Me.objConfirmationLetterWord
.Class = "Word.Document"
.Action = acOLECreateEmbed
End With
End If

If you don't have too many documents (no more than a few hundred) I think
it's fine to store them in the db, but if you expect a lot of documents you
might do better keeping them in the file system and working out
configuration settings to know the file location.
 

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