Subject Re: Invalid subscript reference
From Ken Mayer <>
Date Tue, 15 Oct 2019 21:02:19 -0700
Newsgroups dbase.getting-started

On 10/15/2019 8:14 PM, Ruth wrote:
> I'm struggling to figure out why I'm getting the following message.
> Error:  Invalid subscript reference. On line 202 in the subroutine
> This is a modification of a previous program which works.  I assume that
> somehow I'm going out of the range of the data but I can't figure out how.

Typically this means: for an array, the subscript -- the reference to
the value in the array is "not valid", meaning that it doesn't exist by
that name or number (let's say you have 100 items in an array, and you
ask it for item 101 ...).

For a rowset field array, the name of a field may be incorrect.

The subscript is the value inside the square brackets when referencing
an array, and various parts of dBASE use arrays in ways that don't look
like arrays, but are. So as noted a rowset field array:


that's an array ... you can reference a field by name, or by a field
number ...

There's too much code there for me to spend time looking through it (am
about to head for bed ...). But I hope that I have given you some
thoughts to help you debug your own code.

If you're not sure, it's sometimes a good idea to insert ? commands
inside the code, to check the values of variables, show you where you
are in the code. It's an old technique (I never got comfortable with the
dBASE debugger), but it works great.


*Ken Mayer*
Ken's dBASE Page:
The dUFLP:
dBASE Books:
dBASE Tutorial: