The OLE object is empty

Joined
Jun 6, 2008
Messages
1
Reaction score
0
I am new to VBA for access. I have done a small VBA project with excel but this my first attempt to do anything with access.

I'm getting "The OLE object is empty" and I understand why. what I want to do is avoid this by automatically creating a word document and embedding it in the field in question when a user starts entering a new record. What I have found sugests that I use _beforeinsert but I can not seem to figure out how to do it. It may be that I am just placing the code in the wrong place.

this is the code I have found and tried to modify to use.
__________________________________________________ _______-
Option Compare Database


Private Sub tfirrdata_BeforeInsert(cancel As Integer)
' Specify what kind of object can appear in the field.
block18a.Class = "Word.Document"

' Specify what kind of object can appear in the field.
block18a.OLETypeAllowed = OLE_EMBEDDED

' Create the embedded object.
block18a.Action = OLE_CREATE_EMBED

' Invoke Word for Windows to edit the empty embedded object.
block18a.Action = OLE_ACTIVATE

End Sub
__________________________________________________ ________


The problem is this never fires.

the form in question is named "tfirrdata"

the field i want to embed the word document into is "block18b"

with excel it's fairly easy to figure out where your code needs to go... but access isn't quite so simple.

Lee G. Weaver
 

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