BeforeUpdate Event
Occurs immediately before an update command for a record executes.
Note
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
Parameters
cFldState
Specifies the field states of the row being processed. This is the same value as obtained from calling the following function:GETFLDSTATE(-1)
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.
lForce
Specifies the value of the lForce parameter from the TABLEUPDATE( ) function.nUpdateType
Specifies a numeric value in the UpdateType property of the generated CursorAdapter object. The following table lists the possible values for nUpdateType.nUpdateType
Description
1
Update old data with new data. (Default)
2
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.
cUpdateInsertCmd
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.cDeleteCmd
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.
Remarks
Applies To: CursorAdapter Class
If code in BeforeUpdate returns False (.F.), the update operation does not occur.
See Also
Reference
CursorAdapter Object Properties, Methods, and Events