ACC2000: Echo Action Without Any Argument Causes Error

ID: Q209499


The information in this article applies to:

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

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


SYMPTOMS

In Microsoft Access 2000, if you leave the Echo On argument out of the Echo action in a module, you may receive the following error message:

Argument Not Optional.


RESOLUTION

In earlier versions of Microsoft Access, although the Access Help system stated that the default argument for the Echo action was Yes, you had to include the argument in the line of code in order for the action to run properly. With Access 2000, the Echo method of the DoCmd object has no default argument; the argument must be included.

The Echo method of the DoCmd object was added to provide backward compatibility for running the Echo action in Visual Basic code in Microsoft Access for Windows 95. It's recommended that you use the existing Echo method of the Application object instead.


MORE INFORMATION

Steps to Reproduce Behavior

  1. Open the sample database Northwind.mdb.


  2. Create a module and type the following line in the Declarations section:


  3. 
    Option Explicit 
  4. Type the following procedure:


  5. 
    '---------------------------------------------------------------
    ' 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 
  6. On the Debug menu, click Compile Northwind.



REFERENCES

For more information about the Echo action, click Microsoft Access Help on the Help menu, type "Echo" in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

Additional query words: prb


Keywords          : kberrmsg kbdta 
Version           : WINDOWS:2000
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: May 13, 1999