Article ID: 163842 - Last Review: January 19, 2007 - Revision: 3.3 ACC: Compile Error After Converting Form Macros to VBAThis article was previously published under Q163842 Moderate: Requires basic macro, coding, and interoperability skills.
On This PageSYMPTOMS
After you convert macros to Visual Basic for Applications code in a form or
report by using the "Convert Macros to Visual Basic" command, you may
receive the following error message when you use the form or report.
In Microsoft Access 97
This article assumes that you are familiar with Visual Basic for
Applications and with creating Microsoft Access applications using the
programming tools provided with Microsoft Access. For more information
about Visual Basic for Applications, please refer to your version of the
"Building Applications with Microsoft Access" manual.
The expression <Event Name> you entered as the event property setting
produced the following error: Ambiguous name detected: <Procedure Name>.
The expression <Event Name> you entered as the event property setting
produced an error: Compile error.
CAUSE
At one time, the form or report had an event procedure that was later
changed to a macro.
RESOLUTION
To prevent the error, open a form or report class module in Design view
and delete the procedure for the event whenever you replace an event
procedure with a macro.
To resolve the error, use one of the following methods to remove the duplicate procedure in the object's class module. Method 1In Microsoft Access 97, if the object does not contain a mixture of Visual Basic code and macros, you can remove the object's class module before you convert its macros:
Method 2In Microsoft 7.0 and 97, you can open the object's class module in Design view and remove the duplicate procedure:
MORE INFORMATION
When you replace [Event Procedure] with the name of a macro in Design view
of a form or report, the procedure itself remains in the object's class
module. When you convert the macro to a Visual Basic procedure, the Wizard
does not check to see if a procedure for that event already exists, and it
creates a duplicate procedure.
Steps to Reproduce BehaviorThe following example uses a form. You can obtain the same results by using a report.
REFERENCES
For more information about using the Convert Macros to Visual Basic
command, search the Help Index for converting macros or ask the
Microsoft Access 97 Office Assistant.
| Article Translations
|

Back to the top
