procedure CompactDb;
var
Mydb:_DBEngine;
SourceFileName:String;
TargetFileName:String;
begin
SourceFileName:=G_Path+G_CurrentAccount+'.mdb';
TargetFileName:=G_Path+'compact.mdb';
try
Mydb:=CoDBEngine.Create;
Mydb.CompactDatabase(SourceFileName,TargetFileName,'',0,'');
Mydb.FreeLocks;
except
end;
DeleteFile(SourceFileName);
RenameFile(TargetFileName,SourceFileName);
end;