By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,635 Members | 917 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,635 IT Pros & Developers. It's quick & easy.

Insert Ole Object Error 2793

P: n/a
Hi,
I 'm using oleBlob.Action = acOLEInsertObjDlg to insert OLE objects
into a database but when this line is executed I get error 2793 'E & S
Database can't perform the operation specified in the Action property
of the Visual Basic procedure you're trying to run.'

If I hit debug on the error message and then hit F5 the code continues
correctly. Seeing this I tried trapping the error and then resuming
when it occured. However the error continues to occur but the send I
break into the code it will run correctly.

It would help if I could find something on the MS knowledge base. Is
there anything else I can try? I 'll paste the enitre sub below.
Private Sub cmdActivateOLE_Click()

'If there is an object for this record then open it.
'Otherwise insert a new object
On Error GoTo ERR_ActivateOLE
Dim blnObjectExists As Boolean

'Check for existing object
If IsNull(oleBlob) Then
blnObjectExists = False
Else
blnObjectExists = True
End If

If Not blnObjectExists Then
'No Object so insert a new one
oleBlob.OLETypeAllowed = acOLEEmbedded
DoEvents
oleBlob.Action = acOLEInsertObjDlg
DoEvents
End If

'Open the Object in native app and large enough to be usable
If Not IsNull(oleBlob) Then
oleBlob.Action = acOLEActivate
oleBlob.Verb = acOLEVerbOpen
End If
Exit Sub
ERR_ActivateOLE:
Dim intErrCount As Integer
Select Case Err
Case 2793 'Problem loading InsertObject dialog box. Resume
usually sorts this
If intErrCount > 10 Then
MsgBox "Problem encountered while trying to Insert
Atttachment", vbExclamation, "Error Activaiting OLE"
Else
DoEvents
intErrCount = intErrCount + 1
Resume
End If
Case 2001 'Error generated when user hits cancel on
InsertObject Dialog box
Resume Next
Case Else
MsgBox Err.Number & " " & Err.Description, vbExclamation,
"Error Activiating OLE"
End Select

Exit Sub
Resume
End Sub
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I still don't know why the original code didn'y work but I found that if I use

oleBlob.SetFocus
DoCmd.RunCommand acCmdInsertObject

instead then everything works as expected.

Colin.
Nov 12 '05 #2

P: n/a
Having looked at the rest of the code in this module I can see the
problem was me using dodgey coding. The idea was the the user never
sees the ole control and just clicks on a button to insert or veiw
objects. So I hid the ole control on the form and didn't let it have
focus.

Private Sub oleBlob_GotFocus()
cmdActivateOLE.SetFocus
End Sub
This was my mistake, the control must have focus in order display the
Insert object dialog.

If anyone comes across this an a MDSN article please could you attach
it as I couldn't find it anywhere and had to work this out for myself.

Colin.
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.