BeforeInsert Event

Occurs immediately before an insert command for a record executes.

Note

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

PROCEDURE Object.BeforeInsert 
LPARAMETERS cFldState, lForce, cInsertCmd

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.

  • cInsertCmd
    Specifies the value of the InsertCmd property. Visual FoxPro uses the value of cInsertCmd as the insert command, which you can change in this event. However, if you change the value of the cInsertCmd parameter, the value of the InsertCmd property does not change.

Remarks

Applies To: CursorAdapter Class

If code in BeforeInsert returns False (.F.), the insert operation does not occur.

See Also

Reference

CursorAdapter Object Properties, Methods, and Events

GETFLDSTATE( ) Function

TABLEUPDATE( ) Function

InsertCmd Property

AfterInsert Event

Other Resources

Events (Visual FoxPro)