Question:
I am writing a database app in Delphi that is a Customer/Order Management System, and need to display a ‘3 of 7’ type info in the status bar. How can I get the position and number of records?
Answer:
TTable has two properties for displaying the current record and totalrecords, respectively. They are:
RecNo and RecordCount
Your best bet is to place the code that would display these values inthe OnDataChange event of your DataSource component as follows:
procedure TIFMain.DataSource1DataChange(Sender: TObject; Field: TField);begin Panel1.Caption := IntToStr(Table1.RecNo) + ‘ of ‘ + IntToStr(Table1.RecordCount);end;because OnDataChange occurs every time something happens to the underlying dataset, like scrolling to a new record.