Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: "A Module Is Not a Valid Type" Compile Error Message


View products that this article applies to.

This article was previously published under Q208747
Moderate: Requires basic macro, coding, and interoperability skills.

↑ Back to the top


Symptoms

When you compile a database in Microsoft Access, you may receive the following error message:
A module is not a valid type.

↑ Back to the top


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 procedures in the module has a form variable such as the following:
Dim f as Form
				

↑ Back to the top


Resolution

Rename the module to a name other than a Microsoft Access object name or a Data Access Object name.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

↑ Back to the top


More information

This error did not occur in Access 2.0. If you have converted your database from Access 2.0 to Access 2000, you my receive this error if you have any modules named as described in the "Symptoms" section of this article.

Steps to Reproduce Problem

  1. Create a module and type the following line in the Declarations section if it is not already there:
    Option Explicit
    					
  2. Type the following procedure:
    Function Test(F as Form)
       MsgBox "Form Name: " & F.Name
    End Function
    					
  3. Save the module and name it Form.
  4. On the Debug menu, click Compile <database name>. Note that you receive the following error message:
    A module is not a valid type.

↑ Back to the top


References

For more information about naming conventions, click Microsoft Access Help on the Help menu, type guidelines for naming objects in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

↑ Back to the top


Keywords: KB208747, kbpending, kbbug, kberrmsg

↑ Back to the top

Article Info
Article ID : 208747
Revision : 2
Created on : 7/15/2004
Published on : 7/15/2004
Exists online : False
Views : 290