TDbf And FilePathFull lazarus / 21-General ---------------------------------------------------------------------- Fabius · 2021-06-07 17:21 Hello all I have a problem with the DBF parameter I can't seem to fill in the path Either by form.activate or Dbf.beforeopen Do you have any idea how to do it, I am using the code below, but I have errors satkoverflot database In short, it doesn't work Ideas ? please 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    if Tdbfcompte.Active = True then   begin    Tdbfcompte.Active := False;   end;    if Tdbfcompte.Active = False then   begin    Tdbfcompte.Exclusive:= True;    Tdbfcompte.FilePathFull:= ExtractFilePath(Application.ExeName)+'\tables';    Tdbfcompte.FilePath:= ExtractFilePath(Application.ExeName)+'\tables';    Tdbfcompte.TableName:= 'comptes.dbf';    Tdbfcompte.Exclusive:= False;    Tdbfcompte.Active := True;    Tdbfcompte.First;   end; [Edited to add code tags - please see How to use the Forums.] ---------------------------------------------------------------------- wp · 2021-06-07 17:32 Read this: https://wiki.freepascal.org/Lazarus_Tdbf_Tutorial#Setting_the_path ---------------------------------------------------------------------- Fabius · 2021-06-07 17:54 Hello Thank you for the answer I understood that .... I show an example of what I did but to distribute the EXE the path changes with each installation we must therefore tell the dbf, the path to opening the EXE but it crashes  Tdbfcompte.FilePathFull:= ExtractFilePath(Application.ExeName)+'\tables'; ---------------------------------------------------------------------- Handoko · 2021-06-07 19:15 This should work on both Windows and Linux: 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 procedure TfrmMain.FormCreate(Sender: TObject);  const  DataFileName = 'MyData';begin// ...  MyDbf.FilePathFull := ExtractFileDir(ParamStr(0));  MyDbf.TableName    := DataFileName + '.dbf';// ...end; You can add sub directory at the end of FilePathFull if you want. Note: Using ParamStr(0) can cause problem on some OSes but I've been using the code above for years on Ubuntu for a small dbf note taking program I wrote and use it almost everyday, so far no problem. You should search the forum, there was a discussion for the better solution. ---------------------------------------------------------------------- Fabius · 2021-06-08 08:17 Hello All Thank compile , ok but  if open , error 00000001000041B2 e859010000               callq  0x100004310 ---------------------------------------------------------------------- wp · 2021-06-08 08:42 I am attaching a working example for you to compare. It creates the dbf at first start and adds some dummy data. The dbf will be in a subdirectory "data" of the application folder. Subsequent starts skip the creating step and open the now-existing dbf. ---------------------------------------------------------------------- Fabius · 2021-06-08 08:47 Quote from: wp on June 08, 2021, 10:42:49 amI am attaching a working example for you to compare. It creates the dbf at first start and adds some dummy data. The dbf will be in a subdirectory "data" of the application folder. Subsequent starts skip the creating step and open the now-existing dbf. thank you very much, I will retest ---------------------------------------------------------------------- Fabius · 2021-06-10 14:34 Form1.Xsaisie.FilePath:= Application.Location + 'tables\';   Very important the \ , lool ---------------------------------------------------------------------- wp · 2021-06-10 14:38 Not important for the dbf per se, but important when something is done like I do: Application.FilePath + Application.TableName, I agree.