APPEND lets you add individual records to a table, either interactively or behind the scenes. It’s also first cousin to the
APPEND FROM and
APPEND FROM ARRAY commands, which add batches of records. They’re discussed elsewhere.
APPEND [ BLANK ] [ IN nWorkArea | cAlias ] [ NOMENU ]
Used alone, APPEND opens a window for adding new records to the current table. The window displays records in the EDIT format (as opposed to BROWSE format). Each time you add data to the current new record, a template for another new record is added. The new record isn’t committed to the table, however, until you actually put some data in it. This form of APPEND is really another variation of BROWSE. Notice that the same menu pad (Table) appears for APPEND as for BROWSE or EDIT, and the View menu pad displays the options for EDIT or BROWSE views.
APPEND BLANK adds a record with no interaction. All fields are blank (that is,
ISBLANK() is true for each field in the added record). APPEND BLANK has had an up-and-down history. Prior to FoxPro 2, it was a very important command as the primary programmatic way to add new records. Then, INSERT-SQL stole the show because it has some advantages when editing memory variables—it’s faster to INSERT a record than to APPEND BLANK and GATHER. With the addition of buffering in Visual FoxPro, APPEND BLANK has undergone a renaissance as a good way to work in data input forms. When you’re working with buffered data, APPEND BLANK is the only way to add a blank record without firing rules. If your rules prohibit some columns from being empty, you need APPEND BLANK to give the user an empty record to fill.
The IN clause lets you add a record in a work area other than the current work area. Watch out for one documented, but nonetheless weird, behavior: When you APPEND BLANK IN another work area, everything behaves the way you’d expect—the record is added and you’re left in the same work area you started in. But when you issue APPEND IN another work area, that work area becomes current.
NOMENU suppresses the Table pad and the Browse-related options on the View pad.
APPEND without BLANK respects
VFP 7 Service Pack 1 fixes a relatively obscure bug in earlier versions (we didn't even know it existed until Microsoft told us they fixed it): You no longer get an Internal Consistency Error when you append records to a buffered table when one of the indexes consists of very short keys (that is, the index is on a small field) and every one is identical (we told you it was obscure!).
USE TestData APPEND && Now add data interactively * This code might appear in the Click event of a Save button * for a data entry screen that's in "continuous add" mode = TABLEUPDATE() APPEND BLANK ThisForm.Refresh()