Board index » delphi » TTable error question

TTable error question

I'm just getting started with Delphi after several years away from
programming (most of which was Turbo/Borland Pascal).  I have a dataset
called SongTable of type TTable.  The following is attached to a button:

procedure TForm1.RangeP(Sender: TObject);
begin
  with SongTable do
    begin
      KeyExclusive := True;
      SetRangeStart;
      FieldByName('SongTitle').AsString := 'P';
      SetRangeEnd;
      FieldByName('SongTitle').AsString := 'Q';
      ApplyRange;
    end;
end;

When the KeyExclusive line tries to run I get an exception class
EDatabaseError that says 'SongTable: Dataset not in edit or insert
mode'.  If I force the dataset to edit or insert mode I get a message at
SetRangeStart that says something to the effect that the dataset is
locked by another process.

I'm probably overlooking something simple.  Any help would be
appreciated.

Martin

P.S.  I really miss having printed manuals.  The online documentation is
_much_ harder to use.  Back with BP I could read manuals during down
time, on a plane, and bedtime reading, etc.  I'm really disappointed
that the industry is going so heavily to online documentation.

 

Re:TTable error question


I have had one private reply that suggested filters instead or using ranges,
but have as yet had no public reply and have not figured out why the range
stuff will not work.  I would really appreciate any comments or help anyone
can offer.

Thanks,
Martin

Other Threads