Microsoft KB Archive/109951

{|
 * width="100%"|

ACC1x: "Illegal Function Call" Error When Exporting Module

 * }

Q109951

-

The information in this article applies to:


 * Microsoft Access versions 1.0, 1.1

-

SYMPTOMS
When you run an Access Basic procedure to export a module from one Microsoft Access database to another containing a module of the same name, you receive the error message "Illegal function call."

RESOLUTION
There are two methods for working around this problem:


 * Use a macro with the TransferDatabase action to export the module.
 * Verify that no module in the destination database has the same name as the module you want to export. If necessary, change the name of the module before exporting it.

STATUS
Microsoft has confirmed this to be a problem in Microsoft Access versions 1.0 and 1.1. This problem no longer occurs in Microsoft Access version 2.0.

Steps to Reproduce Problem
 Create a copy of the sample database NWIND.MDB. Name the copy DEST.MDB. Open the NWIND.MDB database.  Create a new module with the following sample code, and then save the module as SourceMod.

NOTE: In the following sample code, an underscore (_) is used as a line- continuation character. Remove the underscore from the end of the line when re-creating this code in Access Basic.

     '******************************* ' Declarations section of module '*******************************     Option Explicit

Function ExportSourceMod DoCmd TransferDatabase A_EXPORT, "Microsoft Access", "DEST.MDB",_ A_MODULE, "SourceMod", "DestMod" End Function  In the module's Immediate window, type the following line, and then press ENTER:

? ExportSourceMod 

The SourceMod module will be exported to the DEST.MDB database. Repeat step 4. This time, you will receive the error message stated above, because the module already exists in the destination database.