ACC: "Expected: =" Error When ? Is Omitted in Debug Window

ID: Q162463

The information in this article applies to:

SYMPTOMS

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

When you use the Debug window (or the Immediate window in version 2.0) to run a built-in or user-defined function that returns a value, if you omit a question mark (?) at the beginning of the line, you may receive one of the following messages:

   Expected: =

   Expected: expression

   Expected: )

RESOLUTION

In the Debug Window, type a question mark before the function name when you run a function that returns a value.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

1. Open the sample database Northwind.mdb.

2. In Microsoft Access 7.0 or 97, press CTRL+G to open the Debug Window.

   In Microsoft Access 2.0, open the Utility Functions module in Design
   view, and then click Immediate Window on the View menu.

3. Type Date() in the Debug window and press ENTER. Note that you receive
   the following error message.

   In Microsoft Access 97:

      Compile error:
      Expected: =

   In Microsoft Access 2.0 and 7.0:

      Expected: =

4. Type Now() in the Debug window and press ENTER. Note that you receive
   the following error message.

   In Microsoft Access 97:

      Compile error:
      Expected: =

   In Microsoft Access 7.0:

      Expected: expression

   In Microsoft Access 2.0:

      Expected: statement

5. Type Left("This",2) in the Debug window and press ENTER. Note that you
   receive the following error message:

   In Microsoft Access 97:

      Compile error:
      Expected: =

   In Microsoft Access 7.0:

      Expected: )

   In Microsoft Access 2.0:

      Expected: statement

6. Repeat steps 3 through 5, but type a question mark at the beginning of
   each function. Note that you receive results instead of error messages.

Additional query words:
Keywords          : kberrmsg kbprg
Version           : 2.0 7.0 97
Platform          : WINDOWS
Hardware          : x86
Issue type        : kbprb

Last Reviewed: November 20, 1998