ACC: Error 2753 Using BeforeInsert to Populate Bound OLE ControlID: Q180313
|
Advanced: Requires expert coding, interoperability, and multi-user skills.
When you try to use the BeforeInsert event to populate a bound OLE control
on a form, you may receive the following error.
Run-time Error '2753':
A problem occurred while Microsoft Access was communicating with the OLE server.
Close the OLE server and restart it outside of Microsoft Access. Then try the original operation again in Microsoft Access.
Run-time Error '2753':
A problem occurred while Microsoft Access was communicating with the object application.
Solution
Close the object application, and then restart it outside of Microsoft Access. Then try the original operation again in Microsoft Access.
The following example uses the Current event to populate a bound OLE control every time you create a new record. It creates the object only if the control is empty.
Private Sub Form_Current()
' If the control is empty.
If Me![OLETest].OLEType = acOLENone Then
With Me![OLETest]
' Set the object type to Embedded.
.OLETypeAllowed = acOLEEmbedded
' Set the class.
.Class = "Excel.Sheet"
' 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!ID.SetFocus
End If
End Sub
Microsoft has confirmed this to be a problem in Microsoft Access versions 7.0 and 97.
Table: tblOLETable
------------------------
Field Name: ID
Data Type: Text
Field Name: OLETest
Data Type: OLE Object
Private Sub Form_BeforeInsert(Cancel As Integer)
With Me![OLETest]
' Set the object type to embedded.
.OLETypeAllowed = acOLEEmbedded
' Set the class.
.Class = "Excel.Sheet"
' Create the embedded object.
.Action = acOLECreateEmbed
' Size the object to fit the control.
.SizeMode = acOLESizeStretch
End With
End Sub
Additional query words: custom activex active x
Keywords : IntpOlea IntpCstm
Version : WINDOWS:7.0,97
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: May 13, 1999