Packing a DBase IVTable
I know this subject has been covered before, but I am getting a 'Table
Busy' error on a routine I call to open all tables exclusively. The
code is as follows:
Function TDataModule1.OpenTables(lMode :Boolean):Boolean;
{
Routine to open all tables used by the application.
var
Dest :array[0..55] of char;
Temp :array[0..10] of char;
I :integer;
begin
for I := 0 to ComponentCount -1 do
begin
if (Components[I] is TTable) and (TTable(Components[I]).Name <>
'ClientTbl') then
repeat
begin
result := True;
TTable(Components[I]).Exclusive := lMode;
try
TTable(Components[I]).Active := True;
except
on EDataBaseError do
begin
StrPCopy(Dest,'Could not open ');
StrPCopy(Temp,TTable(Components[I]).TableName);
StrCat(Dest,Temp);
StrCat(Dest,'.DBF Exclusively - OK to Retry?');
if MessageDlg(Dest, mtError,[mbYes, mbNo], 0) <> mrYES
then
begin
result :=False;
Exit;
end;
end;
{ The dataset could not be opened }
end;
end;
until False;
end;
end;
In the de{*word*81}, the table shows as shared, and inactive, then
exclusive, but when I try to enable the TTable I get the exception. Any
ideas?