(Solved)DBF Packtable lazarus / 16-Databases ---------------------------------------------------------------------- MVD · 2017-09-21 10:07 Hi, I have a program that is working very well, I have only one problem. I am working with DBASE VII tables ( I know, is old  and there are more modern databases but I am confortable with it because I was programming in Delphi6 long time ago) and the table is open Shared.(So we can use the program with 2 or more users). I have a menu item to clean up the database. Regenerating indexes is no problem but when I try to pack the table with ".packtable" I have a problem. To pack the table I have to set the exclusive propertie, If a set: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i [color=red]  hoofdvenster.Dbf1.Exclusive:=true;   hoofdvenster.Dbf1.PackTable; [/color]I got the message : "Exclusive access is required for this operation" If I set:    Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i [color=red]hoofdvenster.Dbf1.close;   hoofdvenster.Dbf1.Exclusive:=true;   hoofdvenster.Dbf1.open:=true  ;   hoofdvenster.Dbf1.PackTable; [/color]I got the message : "unable to open file "C:\x.dbf" ?????? ---------------------------------------------------------------------- fred · 2017-09-21 11:35 Perhaps the other has the database open so it can't be opened in Exclusive mode? ---------------------------------------------------------------------- MVD · 2017-09-21 12:58 I am sure that de DBF is not used, so normal "exclusive" must be OK. It is like I can not override the options I see in the object inspector. To work I have to set the database propertie active to false and the exclusive propertie to true ( if I let the active propertie to true I get the compiler error "unable to open file "x.dbf"). The program will work in exclusive mode but setting exclusive to "false" will not change this. procedure THoofdvenster.MenuItem3Click(Sender: TObject); begin    hoofdvenster.Dbf1.Active:=true  ;    hoofdvenster.Dbf1.PackTable;    hoofdvenster.Dbf1.Exclusive:=false;    hoofdvenster.Dbf1.RegenerateIndexes;    form_lijsten.Dbf2.RegenerateIndexes; end; In the program i can not override the exlusive option  from the object inspector. ---------------------------------------------------------------------- fred · 2017-09-21 13:47 You can only change Exclusive when the database is closed/active = false From the TDbf.pdf file: Quote7.12 Exclusive property Exclusive: Boolean read FExclusive write FExclusive default false; Use Exclusive to prevent other applications from accessing a table while it is open in this application. Before opening the table, set Exclusive to true. A table must be closed before changing the Exclusive property. When Exclusive is true, then when the application successfully opens the table, no other application can access it. If the table for which the application has requested exclusive access is already in use by another application, an exception is thrown. To handle such exceptions, wrap the code that opens the table in a try..catch block. See also TryExclusive. Do not set Exclusive to true at design time if you also set the Active property to true at design time. In this case an exception is thrown because the table is already in use by the IDE. ---------------------------------------------------------------------- avra · 2017-09-21 15:51 Quote from: MVD on September 21, 2017, 02:58:23 pmI am sure that de DBF is not used, so normal "exclusive" must be OK.If you forgot to uncheck TDBF's Active property in design mode, then in runtime you have 2 active users on the same DBF. ---------------------------------------------------------------------- MVD · 2017-09-21 19:50 Quote from: avra on September 21, 2017, 05:51:07 pmQuote from: MVD on September 21, 2017, 02:58:23 pmI am sure that de DBF is not used, so normal "exclusive" must be OK.If you forgot to uncheck TDBF's Active property in design mode, then in runtime you have 2 active users on the same DBF.  T :Dhanks, this is the solution, it seems as simple as one thinks about it. Fred, where did you find the TDbf.pdf file? ---------------------------------------------------------------------- fred · 2017-09-22 06:58 I have the (old) TDbf.pdf from here: https://sourceforge.net/projects/ tdbf/files/TDbf%20documentation/TDbf%20documentation%201.1/