EPUB | CHM | PDF

TDataSet.Events.AfterOpen

Top Previous Next

Occurs after an application completes opening a dataset and before any data access occurs.

Syntax:

property AfterOpen: TDataSetNotifyEvent;

Description:

Write an AfterOpen event handler to take specific action immediately after an application opens the dataset. AfterOpen is called after the cursor for the dataset is opened and the dataset is put into dsBrowse state. For example, an AfterOpen event handler might check the system registry to determine the last record touched in the dataset the previous time the application ran, and position the cursor at that record.

Example:

This example updates the form's status bar with a message when an AfterOpen event occurs.

procedure TForm1.Table1AfterOpen(DataSet: TDataSet);
begin
  // now that the table is open, record information is available
  StatusBar1.SimpleText := 'Record ' + IntToStr(PSQLTable1.RecNo) + 'of ' + IntToStr(PSQLTable1.RecordCount);
end;