Compact access problem
My compact code is not working on all PCS. It works on most of installs.
On some PCS I get
Invalid class string
or OLE Error 40080112
The PC has Office 97 installed on it. Access 97 as well.
The registry is only referencing the DAO 35 version. It only has on the
hard drive those file as well. The compact work in Access.
Am I missing some Ole dll or something?
Thanks:
Here is my compact code:
var varDBEngine: variant;
strTempPathName: string;
begin
result := true;
try
strTempPathName := ExtractFilePath(strDBPathName);
strTempPathName := strTempPathName + 'temp.mdb';
varDBEngine := CreateOleObject('DAO.DBEngine.35'); {err occurs here}
try
database1.Connected := false;
varDBEngine.CompactDatabase(strDBPathName, strTempPathName);
DeleteFile(strDBPathName);
RenameFile(strTempPathName, strDBPathName);
except
on E: Exception do
begin
result := false;
ShowMessage(E.Message);
{ ShowException(ExceptObject,ExceptAddr); if you want address info,
also shows error class }
end;
end;
finally
varDBEngine := Unassigned;
database1.Connected := true;
end;