Board index » delphi » Compact access problem

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;

 

Re:Compact access problem


There was an OLE update for Win95.  You might want to try installing
that update and see if it helps.

Quote
Leapin wrote:

> 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;

--
---------------------------------------------------------------------
Jeff Overcash (TeamB)   On waves of silver I dreamed of gold
(Please do not email    'Till I lost the peace that dreaming gives
 me directly unless     I dreamed of the moment of my own death
 asked.  Thank You)     That no one ever dreams and lives (Marillion)
---------------------------------------------------------------------

Re:Compact access problem


The unworking PC in question has Windows 98 installed.  All the files
containing 'OLE' in the name in the Windows\system folder
are from 5\11\98 8:01 PM
the same as on my PC which works.  Are there other ole related files that I
should check?

Thanks Leapin

Quote
Jeff Overcash (TeamB) wrote in message <3742E701.6FD67...@onramp.net>...
>There was an OLE update for Win95.  You might want to try installing
>that update and see if it helps.

>Leapin wrote:

>> 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;

>--
>---------------------------------------------------------------------
>Jeff Overcash (TeamB)   On waves of silver I dreamed of gold
>(Please do not email    'Till I lost the peace that dreaming gives
> me directly unless     I dreamed of the moment of my own death
> asked.  Thank You)     That no one ever dreams and lives (Marillion)
>---------------------------------------------------------------------

Other Threads