Occurs immediately before an update command for a record executes.


If batch updating is used, that is, CursorAdapter BatchUpdateCount property is greater than 1, BeforeUpdate does not occur.

PROCEDURE Object.BeforeUpdate 
LPARAMETERS cFldState, lForce, nUpdateType, cUpdateInsertCmd, cDeleteCmd



Specifies the field states of the row being processed. This is the same value as obtained from calling the following function:

 CopyCode imageCopy Code

For example, this value can be a character string consisting of deletion and edit status values for all fields in the table or cursor. If a table has five fields and only the first field has been edited, GETFLDSTATE( ) returns a value of 121111. The number 1 in the first position indicates the deletion status has not been changed.


Specifies the value of the lForce parameter from the TABLEUPDATE( ) function.


Specifies a numeric value in the UpdateType property of the generated CursorAdapter object. The following table lists the possible values for nUpdateType.

nUpdateType Description


Update old data with new data. (Default)


Update data by deleting old data and inserting new data.

Changing this value changes the behavior for the current record but does not change the value of the property. You need this value only if you are using automatic updating.


Specifies the value of the UpdateCmd or InsertCmd property as appropriate. Visual FoxPro uses the value of this parameter as the update or insert command, which you can change in this event. However, if you change the cUpdateInsertCmd parameter, the UpdateCmd and InsertCmd properties do not change.


Specifies that cDeleteCmd is empty if the nUpdateType parameter is set to 1. Otherwise, set cDeleteCmd to the value of the DeleteCmd property. Visual FoxPro uses the value of cDeleteCmd as the delete command, which you can in this event. However, if you change the cDeleteCmd parameter, the value of the DeleteCmd property does not change.

Expand imageRemarks

Expand imageSee Also