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



The information in this article applies to:

  • Microsoft Access 2.0
  • Microsoft Access for Windows 95 7.0
  • Microsoft Access 97

This article was previously published under Q162463
Moderate: Requires basic macro, coding, and interoperability skills.

SYMPTOMS

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: =

-or-

Expected: expression

-or-

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.

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kberrmsg kbprb kbProgramming KB162463