ACC2002: Error When You Run RecordExit Function or Sub Procedure (286595)
The information in this article applies to:
This article was previously published under Q286595 Advanced: Requires expert coding, interoperability, and multiuser skills.
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).
SYMPTOMS
When you open a form in browse mode, and then run any code on that form, you may receive the following error message
The expression EventName you entered as the event property setting produced the following error: Procedure declaration does not match description of event or procedure having the same name.
* The expression may not result in the name of a macro, the name of a user-defined function, or an [Event Procedure].
* There may have been an error evaluating the function, event, or macro.
where EventName is the event from which you attempted to run the code.
When you compile the project, you receive the following error message:
Compile Error:
Procedure declaration does not match description of event or procedure having the same name.
The following line appears highlighted as the cause of the compile error:
Sub Form_RecordExit()
CAUSE
This issue occurs when a Sub procedure or function is named Form_RecordExit(). This name overlaps a hidden Access form event named RecordExit, which requires a specific syntax.
Although you can create an event procedure to run against this event without harming your form behavior, you must provide the correct parameter syntax when you call the procedure. Without the correct syntax, the project does not compile, and any code that you run on the form returns the error message described in the "Symptoms" section.
RESOLUTION
To resolve this issue, use either of the following methods: MORE INFORMATION
In Microsoft Access 2002, the object model for forms contains a hidden event named RecordExit. Because the event is hidden, it does not appear in the Property list for the form object in the Visual Basic Environment (VBE). However, if you write a Sub procedure named Form_RecordExit(), the procedure does not work unless it uses a specific syntax.
This hidden event did not exist in Microsoft Access 2000 or earlier.
If you write a project in Access 2000 and then open it in Access 2002, Access silently uncompiles the project. You do not receive any notification until you open the form and attempt to run Microsoft Visual Basic for Applications (VBA) code in it, or until you try to recompile the project.
REFERENCESFor additional information about how to implement the RecordExit event, click the article number below
to view the article in the Microsoft Knowledge Base:
304139 How to Programmatically Implement a RecordExit Event
Modification Type: | Major | Last Reviewed: | 9/26/2003 |
---|
Keywords: | kbprb KB286595 |
---|
|