TableUpdate

The VFP function that commits changes made to a view or buffered table to the underlying data store.


The syntax is;

TableUpdate(nRecords, lForce, cAlias, ArrayName)

nRecords is a number (0, 1, or 2) where:

0 updates only the current record

1 updates all records but stops on the first record that fails

2 update all records and will continue to update additional records after a record fails to update

(this first argument still supports the older syntax of a logical where .T. is identical to 1 and .F. the same as 0)
lForce Logical expression where .T. forces the update past an Update conflict and .F. does not force past an Update Conflict

cAlias is a character expression that identifies the alias name of the work area to which the TableUpdate should be applied.

ArrayName the name of an array that will hold one element for each record number that failed to update when nRecords is set to 2.

Return Value

Logical data type. TABLEUPDATE( ) returns True (.T.) if changes to all records are committed.
Otherwise, TABLEUPDATE( ) returns False (.F.) indicating a failure. An ON ERROR routine isn’t executed. The AERROR( ) function can be used to retrieve information about the cause of the failure.


It is advised that the alias name ALWAYS be supplied when using TableUpdate because in event driven applications it is not necessarily known what the current work area will be when the code executes. By supplying the alias name one knows that the update will occur in the correct work area.