Microsoft KB Archive/101126

= ACC: Echo Action Without Any Argument Causes Error =

Article ID: 101126

Article Last Modified on 1/18/2007

-

APPLIES TO


 * Microsoft Access 1.0 Standard Edition
 * Microsoft Access 1.1 Standard Edition
 * Microsoft Access 2.0 Standard Edition
 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q101126



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



SYMPTOMS
In Microsoft Access 7.0 and 97, if you leave the Echo On argument out of the Echo action in a module, you may receive the error message, "Argument Not Optional."

In Microsoft Access 1.x and 2.0, if you leave the Echo On argument out of the Echo action in a module, you may receive the error message, "Expected: Expression."



RESOLUTION
Although the Microsoft Access Help system states that the default argument for the Echo action is Yes, you must include the argument in the line of code in order for the action to run properly.



Steps to Reproduce Behavior
In Microsoft Access 7.0 and 97:

 Open the sample database Northwind.mdb. Create a new module.  Enter the following code in the Module window:

    '--- ' The following function will produce the syntax error mentioned ' in the "Symptoms" section. '---

Function Test Docmd.Echo        ' Note that the arguments are missing. End Function  On the Run menu, click Compile Loaded Modules.

In Microsoft Access versions 1.x and 2.0:

 Open the sample database NWIND.MDB.</li> Create a new module.</li>  Enter the following code in the Module window:

<pre class="fixed_text">     '-- 'The following function will produce the syntax error mentioned 'in the "Symptoms" section. '--

Function Test Docmd Echo        ' Note that the arguments are missing. End Function </li></ol>

<div class="references_section">