Subject Re: [ib-support] Record Count
Author Woody
From: "Mike Grover" <mike@...>

> Can I look at this?

Sure, here it is. As you can see, I use the IBX components but you can
change this to use whichever query components that you use.

HTH
Woody

function GetRecordCount(Query: TIBQuery): integer;
var
ibCount: TIBQuery;
begin
result := 0;
try
ibCount := TIBQuery.Create(nil);
with ibCount do begin
Transaction := Query.Transaction;
Database := Query.Database;
ibCount.SQL.Text := 'Select Count(*) ' +
copy(Query.SQL.Text, pos('from', lowercase(Query.SQL.Text)),
length(Query.SQL.Text));
ibCount.Open;
result := ibCount.Fields[0].AsInteger;
ibCount.Close;
end
except
on E: Exception do
ShowMessage('Error retrieving record count.');
end;
ibCount.Free;
end;