Board index » delphi » AddIndex gives error 12040 Higher table level required

AddIndex gives error 12040 Higher table level required

I'm trying to add an index to a table.
I get error message 12040 Higher table level required.
Could anyone help me to solve this?
I've tried all sorts of combinations.
The file is Paradox 5 and I've even upgraded it to Paradox 7.
I'm using Delphi 3.

Here is my code:
----------------------------------------------------------------------------
-----
procedure TForm1.UpgradeBtnClick(Sender: TObject);
var
  NewIndex: IDXDesc;
  d : DBIResult;
begin
  with T_DELETE do
  begin
     TableName := 'member.db';
     Exclusive := True;
     Active := True;
     FillChar(NewIndex, SizeOf(NewIndex), 0);
     if Exclusive = False then
           raise EDatabaseError.Create
              ('Members table is opened elsewhere');
     NewIndex.szName:= 'ORGAN_IDX';
     NewIndex.iIndexId:= 0;
     NewIndex.bPrimary:= FALSE;
     NewIndex.bUnique:= FALSE;
     NewIndex.bDescending:= TRUE;
     NewIndex.bMaintained:= TRUE;
     NewIndex.bSubset:= FALSE;
     NewIndex.bExpIdx:= FALSE;
     NewIndex.iFldsInKey:= 4;
     NewIndex.aiKeyFld[0]:= 28;  { numeric }
     NewIndex.aiKeyFld[1]:=29;   { numeric }
     NewIndex.aiKeyFld[2]:=6;    { alpha 30 characters }
     NewIndex.aiKeyFld[3]:=1;    { numeric }
     NewIndex.abDescending[0]:=TRUE;
     NewIndex.abDescending[1]:=TRUE;
     NewIndex.abDescending[2]:=TRUE;
     NewIndex.abDescending[3]:=TRUE;
     NewIndex.bCaseInsensitive:= TRUE;

d:=DbiAddIndex(T_DELETE.dbhandle,T_DELETE.handle,PChar(TableName),szParadox,
NewIndex,nil);
     Check(d);
     Active := False;
  end;
end;
----------------------------------------------------------------------------
-----------------
Thanks a lot,
Craig.

 

Re:AddIndex gives error 12040 Higher table level required


Quote
>I'm trying to add an index to a table.
>I get error message 12040 Higher table level required.
>Could anyone help me to solve this?
>I've tried all sorts of combinations.
>The file is Paradox 5 and I've even upgraded it to Paradox 7.

If it is actually a Paradox 7 table then it should work.  However the level of
table is set when the table is created so just reseting the default leve in the
BDE config to 7 will not change an existing table.  One quick way to convert a
table to version 7 is to add a desdcening index with the Database desktop.

--
Brian Bushay (TeamB)
Bbus...@DataGuidance.com

Other Threads