FoxPro Gotcha

Here are ten things that we all know are wrong but which keep catching us out.

  1. Include your database in the project and wonder why you cannot create a new view.
  2. Put a SKIP inside a SCAN loop. SCAN performs an implicit SKIP so that you process every alternate record.
  3. Write an expression in the View or Query Designer and run the query. Fox won't remind you to press the 'Add' button.
  4. Use a COPY TO without having specified a path and lose your files. Fox will probably put them in C:\Program Files\Visual Studio\VFP.
  5. Declare the array as LOCAL laTemp[1] before executing a COPY TO ARRAY and just get a single field in the array. Unlike most other array commands, COPY TO ARRAY doesn't resize the array automatically. Use SELECT ... INTO ARRAY instead.
  6. Concatenate the FirstName and LastName fields and forget to trim the spaces so you get 'John_____Smith_____'
  7. Concatenate the trimmed FirstName and LastName fields and forget to put a space between them so you get 'JohnSmith'
  8. Use an SQL SELECT statement as the RowSource for a Combo or ListBox but forget an 'INTO CURSOR Dummy' clause. The SQL will display its output in a Browse window because that's the default destination.
  9. Type SELECT Customer IN 0 and start processing Customer records. You are (of course) not in the Customer work area.
  10. Use LIST TO FILE and forget the NOCONSOLE option. You'll get all the information streamed to the active form.