Microsoft KB Archive/312851

= You receive a &quot;Compile error&quot; error message when you run a function or a procedure in Access 2002 =

Article ID: 312851

Article Last Modified on 8/13/2004

-

APPLIES TO


 * Microsoft Access 2002 Standard Edition

-



This article was previously published under Q312851



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

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

For a Microsoft Access 2000 version of this article, see 210098.



SYMPTOMS
When you run a procedure or a function, you may receive one of the following error messages:

Compile error:

Expected variable or procedure, not module.

-Or-

Microsoft Access can't find the name ' ' you entered in the expression.

-Or-

The expression you entered has a function name that Microsoft Access can't find.

All the modules in the database or the project compile successfully.



CAUSE
These errors can occur if a user-defined function or a subroutine has the same name as a module.



RESOLUTION
To resolve these errors, change the name of the module so that the name is different from the name of any procedure or function that you have in the database or project.



Steps to Reproduce the Behavior
 Create a new Access database, and then create a module.  Type the following procedure: Function Test MsgBox &quot;Does this work correctly?&quot; End Function  Save the module as Test .  Type the following line in the Immediate window, and then press ENTER: Test 

Additional query words: conversion name prb

Keywords: kberrmsg kbprb KB312851

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.