Compilation is not successful when you convert a macro to a module (824180)
The information in this article applies to:
- Microsoft Office Access 2003
- Microsoft Access 2002
Moderate: Requires basic macro, coding, and interoperability skills.
This article applies only to a Microsoft Access database (.mdb).
SYMPTOMSWhen you convert a macro to a module, and you then try to
compile the module, the compilation may not be successful. You may see this
problem only when the macro contains a condition and when that condition
statement refers to a form or to any database object.CAUSEThis problem occurs when the condition that is specified in
the macro refers to a form or to a database object and the name of the object
contains spaces. The spaces in the name of the object introduce an extra line
when the macro is converted to a module. Because of this, the compilation of
the module is not successful.STATUS Microsoft
has confirmed that this is a problem in the Microsoft products that are listed
at the beginning of this article.
WORKAROUNDTo work around the problem that is described in the
"Symptoms" section, open the module that is created when the macro is converted
to a module, and then delete the extra space or line from the name of database
object. Replace the code sample that is provided in "More Information" section
of this article with the following code: Function Macro1_TestMacro()
On Error GoTo Macro1_TestMacro_Err
If (Forms![Orders Subform]!Product = "Pavlova") Then
Forms![Orders Subform]!Product.Enabled = True
End If
Macro1_TestMacro_Exit:
Exit Function
Macro1_TestMacro_Err:
MsgBox Error$
Resume Macro1_TestMacro_Exit
End Function
REFERENCES For more information
about macros, click Microsoft Office Access Help on the
Help menu, type macro in the
Search for box in the Assistance pane, and then click
Start searching to view the topic.
Modification Type: | Minor | Last Reviewed: | 6/8/2004 |
---|
Keywords: | kbProgramming kbmacro kbprb KB824180 kbAudDeveloper |
---|
|