Re: Compact/Repair Access 2007 database
- From: MikeR <nf4lNoSpam@xxxxxxxxx>
- Date: Tue, 30 Oct 2007 07:00:50 -0400
Andy wrote:
What component should I get to compact and repair Access 2007 databases. I used to use Adonis JRO to do this but it does not support .accdb 2007 files.Import the type library from msjro.dll
Thanks in advance.
Andy
Then
procedure TfrmLog.mnuCompactDBClick(Sender: TObject);
var
wholePath: string;
JE: TJetEngine;
begin
wholePath := WritePath + FOLDER_NAME + DBName;
if FileExists(WritePath + FOLDER_NAME + 'compacted.mdb') then
DeleteFile(WritePath + FOLDER_NAME + 'compacted.mdb');
if FileExists(wholePath) then
begin
//close the database here
JE:= TJetEngine.Create(Application);
try
try
JE.CompactDatabase(SProvider1 + wholePath, SProvider1 + WritePath + FOLDER_NAME + 'compacted.mdb');
except
on E:Exception do
ShowMessage(E.Message);
end;
finally
JE.FreeOnRelease;
if FileExists(WritePath + FOLDER_NAME + 'compacted.mdb') then
begin
DeleteFile(wholepath);
RenameFile(WritePath + FOLDER_NAME + 'compacted.mdb', wholepath);
// reopen the database
end;
end;
end;
Mike
.
- Follow-Ups:
- Re: Compact/Repair Access 2007 database
- From: Andy
- Re: Compact/Repair Access 2007 database
- References:
- Compact/Repair Access 2007 database
- From: Andy
- Compact/Repair Access 2007 database
- Prev by Date: Progress on long operations
- Next by Date: Re: Graphics VCL
- Previous by thread: Re: Compact/Repair Access 2007 database
- Next by thread: Re: Compact/Repair Access 2007 database
- Index(es):
Relevant Pages
|