ACC: Error 2753 Using BeforeInsert to Populate Bound OLE Control

Last reviewed: February 3, 1998
Article ID: Q180313
The information in this article applies to:
  • Microsoft Access versions 7.0, 97

SYMPTOMS

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.

In Microsoft Access 97

   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.

In Microsoft Access 7.0

   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.

RESOLUTION

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.

  1. Follow steps 1 - 4 in the "Steps to Reproduce Behavior" section.

  2. Switch the form to Design view and set the OnCurrent property of the form to the following event procedure:

          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
    
    

  3. Switch the form to Form view and move to a new record. Note that OLETest is populated when you move to a new record.

STATUS

Microsoft has confirmed this to be a problem in Microsoft Access versions 7.0 and 97. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Start Microsoft Access and open any database.

  2. Create the following table:

          Table: tblOLETable
          ------------------------
          Field Name: ID
    
             Data Type: Text
          Field Name: OLETest
             Data Type: OLE Object
    
    

  3. Close the table and save it as tblOLETable. When prompted to create a primary key, click No.

  4. Use the AutoForm: Columnar Wizard to create a new form based on the tblOLETable table.

  5. Switch the form to Design view and set the BeforeInsert property of the form to the following event procedure:

          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
    
    

  6. Switch the form to Form view.

  7. Type the letter "a" in the ID text box to trigger the BeforeInsert event. Note that you receive one of the errors described in the "Symptoms" section.


Additional query words: custom activex active x
Keywords : IntpOlea IntpCstm
Version : WINDOWS:7.0,97
Platform : WINDOWS
Hardware : x86
Issue type : kbbug
Solution Type : kbpending


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 3, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.