ACC: "A Module is Not a Valid Type" Compile Error Message

Last reviewed: May 14, 1997
Article ID: Q138018
The information in this article applies to:
  • Microsoft Access versions 7.0, 97

SYMPTOMS

Moderate: Requires basic macro, coding, and interoperability skills.

When you compile a database in Microsoft Access 7.0 or 97, you may receive the following error message:

   A Module is not a valid type.

CAUSE

The module has the same name as a Microsoft Access object or a data access object, and it contains a variable declared as the same object type as its name. For example, if the module is named Form, you will receive the error message if any of the module's procedures contains a form variable such as the following:

   Dim f as Form

RESOLUTION

Rename the module to a name other than a Microsoft Access object name or a data access object name.

STATUS

Microsoft has confirmed this to be a problem in Microsoft Access 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 Problem

  1. Start an earlier version of Microsoft Access (version 1.x or 2.0) and create a new database.

  2. Create a module and type the following line in the Declarations section:

          Option Explicit
    

  3. Type the following procedure:

          Function Test(F as Form)
    
             msgbox "Form Name: " & F.Name
          End Function
    
    

  4. Save the module and name it Form.

  5. Close the database and quit the earlier version of Microsoft Access.

  6. Start Microsoft Access 7.0 or 97.

  7. On the Tools menu, point to Database Utilities, and then click Convert Database.

  8. In the "Database to Convert From" dialog box, select the database created in step 1, and click the Convert button.

  9. In the Convert Database Info box, enter a file name and click Save.

  10. Open the converted database after the conversion process has completed.

  11. In the Database window, click the Modules tab.

  12. Open the module named Form in Design view.

  13. On the Run menu, click Compile All Modules.

        Note that you receive the following error message:
    

           A Module is not a valid type.
    

REFERENCES

For more information about naming conventions, search the Help Index for

"naming conventions," or ask the Microsoft Access 97 Office Assistant.


Keywords : CnvOthr kberrmsg kbusage
Version : 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbbug
Resolution Type : kbworkaround


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: May 14, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.