Invalid subscript reference


Sometimes, when you run a program inside visual Foxpro, you will see an error as : “Invalid subscript reference”

Invalid subscript reference error in visual foxpro 10
window of error in foxpro

How to fix

in foxpro when you want to call a program, this is a source with prg extension, so you should call it as:

  • Do test.prg
  • Do test

but autotype of foxpro editor sometimes add parenthesis “()” to the end of text and it is the bad for prg program, it makes foxpro confused between prg files and functions

so when you run command as: do test()

it shows you: Invalid subscript reference

only remove parenthesis “()” from end of command and it will works perfectly

Leave a comment

Your email address will not be published. Required fields are marked *