FoxPro Gotcha


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 aren't 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.

Hints & tips

The textbox class in Visual FoxPro 9 has a new Autocomplete property which shows the user the previous values that have been entered in that textbox.
Autocomplete in VFP 9

Your Access database will look more impressive if you add custom toolbars...
Custom toolbars

FoxPro has always had functions to read and write files at a low level...
Foxpro low level file functions

More...
More pages of hints and tips for users of Microsoft FoxPro and Access databases.

Site Map