Microsoft KB Archive/114633

{| = PRB: dBASE Program Causes "Invalid Subscript Reference" Error =
 * width="100%"|

ID: Q114633

The information in this article applies to:


 * Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b, 2.6
 * Microsoft FoxPro for MS-DOS, versions 2.5, 2.5a, 2.5b, 2.6

SYMPTOMS
A program created in dBASE generates the following error message when run in FoxPro:

Invalid subscript reference.

CAUSE
The program contains an array and a function with identical names. Since FoxPro does not distinguish between parentheses "" and brackets "[]", it cannot differentiate between a reference to a function and a reference to an array.

WORKAROUND
Change the name of one array or function.

STATUS
This behavior is by design.

Steps to Reproduce Problem
Run the following program, which works correctly in dBASE IV, but produces the error message in FoxPro:

DECLARE generic[1] generic[1] = 'array value'

x = generic('') z = generic[1] WAIT 'x: ' + x  WAIT 'z: ' + z

FUNCTION generic PARAMETER y  WAIT 'In GENERIC' RETURN 'generic value' dBASE IV is manufactured by a vendor independent of Microsoft; we make no warranty, implied or otherwise, regarding this product's performance or reliability. Additional reference words: FoxDos FoxWin 2.50 2.50a 2.50b 2.60 errmsg err msg square code application KBCategory: kb3rdparty kberrmsg kbprb KBSubcategory: FxinteropDbase
 * }