通过DAO可以压缩及修复。
function fPackAccessDB(const sFileName : string):boolean;
var
db : OLEVariant;
tmpFile : string;
begin
Result : false;
try
screen.cursor : crSQLWait;
if not DaoActive(db) then Exit;
try
tmpFile := AppendSlash(ExtractFilePath(sFileName))+'MsaTemp.mdb';
db.compactDatabase(sFileName, tmpFile);
DeleteFile(sFileName);
RenameFile(tmpFile, sFileName);
Result := true;
Except
on E: EOleException do
MsgError(E.Message);
end
finally
db := unassigned;
screen.cursor := crDefault;
end;
end;