ACC2000: Compile Error Occurs Using Derived Math Functions in Help (209128)



The information in this article applies to:

  • Microsoft Access 2000

This article was previously published under Q209128
Novice: Requires knowledge of the user interface on single-user computers.

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

SYMPTOMS

In the Microsoft Visual Basic 2000 Help topic Derived Math Functions, a compile error occurs when you copy and paste some of the functions containing a minus sign (-) into a module.

CAUSE

Help uses ASCII character 0150 for the minus sign instead of the correct ASCII character, 0045.

RESOLUTION

After you paste a code example into a module, use the keyboard to manually retype all of the minus signs.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Start Microsoft Access and open any database.
  2. In the Database window, click Modules under Objects, and then click New.
  3. Type the following procedure:
    Function TestMinus()
       Dim X As Integer
       X = 5
       ' Insert formula on next line
    
    End Function
    					
  4. Search the Visual Basic Help Index for "derived math functions."
  5. Locate the Inverse Hyperbolic Cosine function in the Function column, and then select everything to the right of the equal sign (=) in the formula in the Derived equivalents column.
  6. Press CTRL+C to copy the selected text.
  7. In the module window, type the following in the blank line under the comment Insert formula on next line:
    X = 
    					
  8. After the equal sign (=), paste the rest of the formula that you copied from Visual Basic Help. The line should now appear as follows:
    X = Log(X + Sqr(X * X - 1))
    					
  9. Microsoft Access tests each line of code as soon as you move the cursor to a new line. Click the first line of the function, and then notice that you receive the following error message:
    Compile error:
    Expected: line separator or )
  10. Retype the minus sign in the following expression
    X = Log(X + Sqr(X * X - 1))
    						
    and then click the first line of the function. Note that the compile error does not occur.

Modification Type:MajorLast Reviewed:6/24/2004
Keywords:kbprb kbusage KB209128