{
SetRange, CancelRange, Refresh example
The following example sets a range for a dataset. The form requires two edit boxes, a data source, a client dataset or table, a db grid, and a button.
}
procedure TForm1.FormActivate(Sender: TObject);
begin
  Table1.DatabaseName := 'DBDemos';
  Table1.TableName := 'Customer.db';
  Table1.Active := True;
  Table1.IndexName := 'ByCompany';
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  if Button1.Caption = '&Apply Range' then
    begin
      Table1.SetRange([Edit1.Text],[Edit2.Text]);
      Button1.Caption := '&Drop Range';
    end
  else
    begin
      Table1.CancelRange;
      Table1.Refresh;
      Button1.Caption := '&Apply Range';
    end;
end;

