Page 1 of 1

Recordcount not working in datasource.dataset

Posted: Tue 25 Nov 2008 16:00
by jkuiper
I have a baseform with this code

Code: Select all

procedure TBasisFormFld.DataSource1StateChange(Sender: TObject);
begin
  with DataSource1.DataSet do
  begin
    TlBtnNieuw.Enabled := (State in [dsBrowse, dsInactive]);
    TlBtnEdit.Enabled := (State = dsBrowse) and (RecordCount > 0);
    TlBtnPost.Enabled := State in [dsInsert, dsEdit];
    TlBtnDelete.Enabled := (State = dsBrowse) and (RecordCount > 0);
    TlBtnRecRew.Enabled := (State = dsBrowse) and (RecordCount > 0);
    TlBtnRecForward.Enabled := (State = dsBrowse) and (RecordCount > 0);
    TlBtnZoekModus.Enabled := (State in [dsBrowse, dsInactive]);
    TlBtnZoekGevonden.Enabled := (State in [dsBrowse, dsInactive]);
  end;
end;
If I create a new form with the baseform inherited, my datasource checked witch button must me enabled. It works with TMyQuery, but TVirtualTable gives 'recordcount = 0' in this procedure. This is not correct.
I know, because in the childform the recordcount of TVirtualtable shows the correct recordcount.

I'm using TVirtualTable in MyDAC 5.570.0.42 with D2009 pro

Posted: Wed 26 Nov 2008 08:27
by Plash
Maybe the TVirtualTable component on the inherited form doesn't have records.

Posted: Thu 27 Nov 2008 12:13
by jkuiper
But it has. I checked with showmessage() in the baseform and child. The child gives a recordcount, but the baseform gives 0.

Posted: Fri 28 Nov 2008 12:41
by Plash
Probably the VirtualTable component on the base form is not active. Set its Active property to True.