Board index » delphi » Compact Repair mdb file from Delphi 2nd post

Compact Repair mdb file from Delphi 2nd post

As subject.

Thanks

Neil Griffiths

 

Re:Compact Repair mdb file from Delphi 2nd post


To compact and repair an Access database, you must go through the DAO using
OLE objects.

var
    dbEngine : variant;

try
  dbEngine := CreateOLEObject('DAO.DBEngine');
    // replace 'DAO.DBEngine' with 'DAO.DBEngine35' for Access 97....

  dbEngine.RepairDatabase('PutMDBPathAndNameHere');
  dbEngine.CompactDatabase('PutMDBPathAndNameHere',
'PutNewMDBPathAndNameHere','',0,'');
  except
  on E: EOLEError do
  begin
    ShowMessage('Repair/Compact Database: ' + E.Message);
  end;
  dbEngine := unassigned;
end;

Quote
Neil Griffiths <n...@apex-software.com> wrote in message

news:7q3knl$oo62@forums.borland.com...
Quote
> As subject.

> Thanks

> Neil Griffiths

Re:Compact Repair mdb file from Delphi 2nd post


There's stuff at http://delphidao.finalfiler.com

Also, the msUtil component that's available there includes source that shows
how.

--
Pierre
http://delphidao.finalfiler.com
http://delphiotc.finalfiler.com
http://www.finalfiler.com

Quote
Neil Griffiths <n...@apex-software.com> wrote in message

news:7q3knl$oo62@forums.borland.com...
Quote
> As subject.

> Thanks

> Neil Griffiths

Other Threads