OLDVAL( ) Function

Example   See Also

Returns original field values for fields that have been modified but not updated.

Syntax

OLDVAL(cExpression [, cTableAlias | nWorkArea])

Returns

Character, Currency, Date, DateTime, Double, Float, Integer, Logical, Numeric, or Memo

Arguments

cExpression

Specifies an expression whose original value OLDVAL( ) returns from a table or a remote data source. cExpression is typically a field or an expression consisting of a set of fields from the table or remote data source.

cTableAlias

Specifies the alias of the table or cursor from which the original field values are returned.

nWorkArea

Specifies the work area of the table or cursor from which the original field values are returned.

Remarks

OLDVAL( ) returns original field values for records in a Visual FoxPro table or cursor that has row or table buffering enabled with CURSORSETPROP( ).

If a table in a database or a cursor has validation rules, OLDVAL( ) does not require that row or table buffering be enabled in order to return original field values.

If the record pointer is moved to a different record when row buffering is enabled, or if TABLEUPDATE( ) is issued to commit changes to the record, or there is some other action that causes an update, such as ending a transaction, the fields are updated and the original field values are no longer available.

The data type of the value OLDVAL( ) returns is determined by the expression you specify with cExpression.

The original field values are returned for the table or cursor open in the currently selected work area if OLDVAL( ) is issued without the optional cTableAlias or nWorkArea arguments.