Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OLE Word Integration

Status
Not open for further replies.

no1biscuit

Programmer
Oct 8, 2001
67
US
I am thinking about adding an embedded ole field to my table and to my form.
How much bloat would there be to have a text document (less than one page of text per record, probably like 1 paragraph of Microsoft Word Data)?

When I insert the object into the form it works great if I start Word and do a copy and paste into the object. Then I can edit it but if I go to a new record the object does not know to fire word if someone clicks and/or enters it. I am sure it is something simple please help...

Thanks
Thom
 
Here is an example that uses the Double-Click event of an OLE object called WordDoc:

Code:
Private Sub WordDoc_DblClick(Cancel As Integer)
If IsNull(Me.WordDoc) Then
   SendKeys "microsoft word {ENTER}", False
   DoCmd.RunCommand acCmdInsertObject
End If
End Sub

You can use blobs to avoid bloat, it is a different approach:
how do put a file name (OLE word document) into an access table?
thread181-191670

 
You may wish to consider setting the Object Verb to -2.
 
Thanks for the reply. The sendkeys gave me an error.

Here is what I have done but I have one problem.
If Me![wordole].OLEType = acOLENone Then
With Me![wordole]
' Set the object type to Embedded.
'.OLETypeAllowed = acOLEEmbedded
.OLETypeAllowed = 0
' Set the class.
.Class = "Word.Document"
' Create the embedded object.
.Action = acOLECreateEmbed
' Fit the object to the size of the control.
.SizeMode = acOLESizeStretch
End With
' Set the focus back to the ID field.
Me.Parent.fname.SetFocus
End If

It works great except when the field has focus and I go to another record. I instantly get a "The OLE object is empty."
If the control does not have focus then I am fine. This is in a subform.

Thanks
Thom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top