The following code works for me:
create a table with two indexes ...
Dbf1.FilePath:= 'data/';
Dbf1.TableLevel := 4;
Dbf1.Exclusive := True;
Dbf1.TableName:='testdata.dbf';
with Dbf1.FieldDefs do begin
Add('Id', ftString, 4, True);
Add('Name', ftString, 30, True);
end;
Dbf1.CreateTable;
Dbf1.Open;
Dbf1.AddIndex('custid', 'Id', [ixPrimary, ixUnique]);
Dbf1.AddIndex('custname', 'Name', [ixCaseInsensitive]);
Dbf1.Close;
Open the table, select an index, go to first record
Dbf1.FilePath:= 'data/';
Dbf1.TableLevel := 4;
Dbf1.Exclusive := True;
Dbf1.TableName:='testdata.dbf';
Dbf1.Open;
Dbf1.IndexName:='custid';
Dbf1.First;
Toggle between indexes
if Dbf1.IndexName = 'custid' then
Dbf1.IndexName := 'custname'
else
Dbf1.IndexName:='custid';
HTH,
Doug