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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The OLE object is empty

Status
Not open for further replies.

leeweaver

Technical User
Jun 6, 2008
1
US
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
 
Sorry can't help with your problem, but adding Option Explicit before or after Option Compare Database in the general section of the module will save you variable-naming headaches down the road.

"Time flies like an arrow; fruit flies like a banana."
 
In order to create an event procedure you have to click the ellipsis (...) in the property sheet of the form for the relevant event.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top