Problem loading different tables lazarus / 16-Databases ---------------------------------------------------------------------- bernie61 · 2018-04-03 11:50 I have an application that shows a table in a form and allows the user to select another different table to be shown in the same form. It calls a routine passing the table number (as string variable "t") to load and show it. The first time I call this procedure dbf1 is not active, then it simply loads the first table.   if dbf1.active then begin      dbf1.PackTable;     dbf1.Close;     dbf1.active:=false;   end;   dbf1.TableName:='table' + t + '.dbf';   dbf1.active:=true;   dbf1.IndexDefs.Clear;   dbf1.AddIndex('GINDEX','STR(GROUP,5,0)+STR(SUBGROUP,5,0)', [ixCaseInsensitive]); The problem is that it works well only one, two or three times, but in some moment, when I switch tables again, I get an exception: DBFError Exclusive access is required for this operation. I get this exception either when packing the table or when adding the index. But the table has exclusive:=true and there only one instance of the application. I use Lazarus 1.6.4, 64 bits on Windows 7. What I'm doing wrong?