Closing an OleObject

T

tkosel

I have a db with embedded ole objects. I want the user to be able to click
on a description name and that ole object will be launched. I want the
object to only be launched by one user and then not be able to be launched
again. I can control all this except for one thing. If a user launches the
object, then exits from my application, the ole object remains open and
another user could launch the same object.

Code for the Ole Object named Description appears below. This works fine.

Private Sub Description_DblClick(Cancel As Integer)
Me.Lock = True
With Forms.Item("1 - Main Menu").Controls.Item("OLEobject")
.Action = acOLEActivate
.Verb = acOLEVerbOpen
End With
Me.Lock.SetFocus
End Sub

Code which I think should close it appears below.

Private Sub Lock_LostFocus()
Me.Lock = False
With Forms.Item("1 - Main Menu").Controls.Item("OLEobject")
.Action = acOLEClose
End With
End Sub

This gives me a run time error '2793' - Cant perform the op specified in
the action property. I have already verified the enabled and locked
properties properly.

Any ideas on how I can close the ole object?
 

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