Object Reference > True DBGrid Events > AfterInsert Event |
AfterInsert Event
The AfterInsert event occurs after the user inserts a new record into the grid. It can be used to update other tables or to perform post-update cleanup of other controls.
TDBGrid_AfterInsert ( )
Arguments
None
When the user selects the AddNew row (the last row in the grid) and enters a character in one of the cells, the BeforeInsert event is executed, and unless canceled, the row is scrolled up one line and its record selector changes to show that it has been modified. However, a new row has not yet been added to the database.
Once the user commits the new row by moving to another row within the grid, the BeforeUpdate event is triggered, followed by the AfterUpdate and AfterInsert events. If the BeforeUpdate event is canceled, then the AfterUpdate and AfterInsert events will not be fired.
When the AfterInsert event is triggered, the record has already been added to the database. The Bookmark property can be used to access the new record.
The AfterInsert event cannot be canceled. It is fired in both bound and unbound modes.