Board index » delphi » How to compact/repair Access 2000 .mdb file

How to compact/repair Access 2000 .mdb file

It some special function to repair and compact Access 2000 database files .

Where is it? How to do it?

Thanks for aswer.

Alex D.M.

 

Re:How to compact/repair Access 2000 .mdb file


Quote
>It some special function to repair and compact Access 2000 database files .

>Where is it? How to do it?

No functions in Delphi or ADO
You can import the JRO type library and due it through Ole automation

procedure TForm1.btnCompactClick(Sender: TObject);
var
  MyJetEngine : JetEngine;
begin
  strDataSource := 'Data Source=c:\yourdir\yourdb.mdb;';
  strDataDest   := 'Data Source=c:\yourdir\your_compacted_db.mdb;' +
                   'Jet OLEDB:Engine Type=5';

                   {Use Engine Type 5 for Access 2000 db}
                   {Use Engine Type 4 for Access 97 db  }

  MyJetEngine := CoJetEngine.Create();
  try
    MyJetEngine.CompactDatabase(strDataSource, strDataDest);
  finally
    MyJetEngine := nil;
  end;
end;
--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:How to compact/repair Access 2000 .mdb file


Thanks for you aswer, but where can I find JRO type library ?

Alex D.M.

Re:How to compact/repair Access 2000 .mdb file


I wrote a batch file that I execute to compact and backup the db.  Adjust
the path variables to suit your case:

rem Compact/Repair portfolio DB and backup
set path=c:\Program Files\Microsoft Office\Office
set MainPath=d:\bsptf
set BackupPath=d:\bsptfBak
MSACCESS %MainPath%\ptfuser.mdb /compact
rem *** Backup to disk directory
copy %MainPath%\ptfuser.mdb %BackupPath%
rem *** Backup to zip drive
copy %MainPath%\ptfuser.mdb e:

Luis C. Uribe

Quote
Alex D.M. <csdesarro...@nostracom.com> wrote in message

news:8f9965$k9j4@bornews.borland.com...
Quote
> It some special function to repair and compact Access 2000 database files
.

> Where is it? How to do it?

> Thanks for aswer.

> Alex D.M.

Re:How to compact/repair Access 2000 .mdb file


Quote
>Thanks for you aswer, but where can I find JRO type library ?

It is in MSJRO.dll

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads