ACC97: Removing Replicated Module Causes Automation Error

ID: Q171207


The information in this article applies to:


SYMPTOMS

Advanced: Requires expert coding, interoperability, and multiuser skills.

When you open a replica after synchronizing with another replica, you may receive the following error message:

Automation error


CAUSE

An object in the Design Master's Visual Basic for Applications project has been made nonreplicable, and then a synchronization with the replica has been performed from within the Design Master.


RESOLUTION

Correcting the Automation Error After Synchronization

Correcting the Automation error following synchronization depends on how the object was made nonreplicable in the Design Master. If the object was made nonreplicable by clearing the Replicable check box in the object's property window, the error should be corrected after you open the replica a second time following synchronization. The first time you open the replica following synchronization, Microsoft Access automatically compiles and saves the replica's Visual Basic for Applications project. Once Microsoft Access has compiled and saved the replica's Visual Basic for Applications project, you should no longer receive the error when opening the replica.

If the object was made nonreplicable by deleting it from the Design Master, you will continue to receive the Automation error each time you open the replica. In this case, you can correct the error by manually compiling and saving all modules in the replica. To manually compile and save all modules in the replica, follow these steps:
  1. Open the replica that is producing the Automation error.


  2. Create a new, local module.


  3. On the Debug menu, click "Compile and Save All Modules." When prompted to save the module, save it with any name.


  4. Delete the new module created in step 3.


  5. Close the replica, and then reopen it. Note that the Automation error no longer occurs.


Preventing the Automation Error from Occurring

You can prevent the Automation error from occurring by performing the synchronization from within the replica. This causes Microsoft Access to automatically compile and save the replica's Visual Basic for Applications project, and therefore prevents the error from occurring. To initiate the synchronization from within the replica, follow these steps:
  1. Open the replica.


  2. On the Tools menu, point to Replication, and then click Synchronize Now.


  3. Select the Design Master database, and then click OK. You will receive a message confirming the synchronization was completed successfully. Click Yes to close the message.


  4. Close the replica, and then reopen it.



STATUS

Microsoft has confirmed this to be a problem in Microsoft Access 97. This problem no longer occurs in Microsoft Access 97 Service Release 1.

NOTE: Stand-alone Microsoft Access 97 Service Release 1 is not currently available, but you can update your copy of Microsoft Access 97 to Service Release 1 by downloading Microsoft Office Service Release 1 from Microsoft's Web site at:

http://officeupdate.microsoft.com/Articles/sr1fact.htm


MORE INFORMATION

Objects that make up a database's Visual Basic for Applications project include global modules as well as forms and reports whose HasModule property is set to Yes. These objects can be made nonreplicable either by clearing the Replicable check boxes or by deleting the objects from the Design Master.

Steps to Reproduce Behavior

CAUTION: Following the steps in this example will modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and perform these steps on a copy of the database.
  1. Open the sample database Northwind.mdb.


  2. Create a module and type the following line in the Declarations section if it is not already there:
    
           Option Explicit 


  3. Type the following procedure:
    
           Function Test()
              MsgBox "This is a test."
           End Function 


  4. On the Debug menu, click "Compile and Save All Modules."


  5. When prompted for the module name, type mdlReplicationTest, and then click OK. Close the module.


  6. On the Tools menu, point to Replication, and then click Create Replica.


  7. Click Yes when prompted to close the current database.


  8. Click No when prompted to create a backup of the database.


  9. Select a location for the new replica, and then click OK. You will receive a confirmation message indicating the database has been converted to a Design Master, and that a replica has been created. Click OK to close the message.


  10. Open the replica created in steps 6 - 9. Note that Microsoft Access compiles and saves the replica's Visual Basic for Applications project without error.


  11. Open the replicated version of Northwind.mdb.


  12. Delete the "mdlReplicationTest" module created in steps 2 - 5.


  13. On the Tools menu, point to Replication, and then click Synchronize Now.


  14. Select the replica created in steps 6 - 9, and then click OK. You will receive a message confirming the synchronization was completed successfully. Click Yes to close the message.


  15. Open the replica created in steps 6 - 9. Note that you receive the following error message:
    Automation error


Additional query words: pra


Keywords          : kbcode kberrmsg RplUpd RplGen 
Version           : 97
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: April 26, 1999