PDA

View Full Version : Compacting DB Access without Office ?



DarkRider950
02-04-2008, 12:19 PM
Hi , I need some help

I got a VB5 application running on a PC that use Access Database without Office installed on it. This is working fine.

But now the Database is becoming way to big. So I create a simple programe (.net) that will compact the database every night on this PC.Its woking fine on my pc cause I Have the Office Suite installed, but When I try on the "production Pc" I got this error msg "System.Runtime.InteropServices.COMException (0x80040154)"

this is the code



Imports Microsoft.Office.Interop

Module CompactAccessDB

Sub Main()
Try


Dim dbEngine As New Access.Application()
Dim MdbTemps, MdbName As String

MdbName = "c:/DATA/MyDatabase.mdb"
MdbTemps = (Left(MdbName, Len(MdbName) - 4)) & "x.mdb"

System.Diagnostics.Process.Start("C:\data\ren.bat")

dbEngine.Application.CompactRepair(MdbTemps, MdbName)
System.Diagnostics.EventLog.WriteEntry("compaction BD access", "Compact BD")

'System.Diagnostics.Process.Start("\data\Sup.bat")


Catch ex As Exception
System.Diagnostics.EventLog.WriteEntry("compaction BD access", ex.ToString())
End Try

End Sub

End Module

And I did include the following dependencies
o2003PAI.msi
.net framework
Microsoft.Office.Interop.Access.dll
Dao.dll
Microsoft.Vbe.Interop.dll
Office.dlland still not working ...

It probably missing some dll but I can't figure witch one ?!

the batch file are very simle rename and delete file.

thanks

~~Code tags added by Oorang
Please use code tags.

orange
02-06-2008, 07:11 PM
Hi , I need some help

I got a VB5 application running on a PC that use Access Database without Office installed on it. This is working fine.

But now the Database is becoming way to big. So I create a simple programe (.net) that will compact the database every night on this PC.Its woking fine on my pc cause I Have the Office Suite installed, but When I try on the "production Pc" I got this error msg "System.Runtime.InteropServices.COMException (0x80040154)"

this is the code



Imports Microsoft.Office.Interop

Module CompactAccessDB

Sub Main()
Try


Dim dbEngine As New Access.Application()
Dim MdbTemps, MdbName As String

MdbName = "c:/DATA/MyDatabase.mdb"
MdbTemps = (Left(MdbName, Len(MdbName) - 4)) & "x.mdb"

System.Diagnostics.Process.Start("C:\data\ren.bat")

dbEngine.Application.CompactRepair(MdbTemps, MdbName)
System.Diagnostics.EventLog.WriteEntry("compaction BD access", "Compact BD")

'System.Diagnostics.Process.Start("\data\Sup.bat")


Catch ex As Exception
System.Diagnostics.EventLog.WriteEntry("compaction BD access", ex.ToString())
End Try

End Sub

End Module

And I did include the following dependencies
o2003PAI.msi
.net framework
Microsoft.Office.Interop.Access.dll
Dao.dll
Microsoft.Vbe.Interop.dll
Office.dlland still not working ...

It probably missing some dll but I can't figure witch one ?!

the batch file are very simle rename and delete file.

thanks

~~Code tags added by Oorang
Please use code tags.

I have copied some recent materials from another forum in which I participate. There was a recent question along the same line. Compacting a JET database without having access to Access.

You may wish to consider :

> Date: Fri, 1 Feb 2008 10:57:26 -0500
> From: jimdettman@verizon.net
> To: accessd@databaseadvisors.com
> Subject: Re: [AccessD] App using Runtime?
>
> Mark,
>
> Use the standalone JET compact utility: JETCOMP.EXE
>
> http://support.microsoft.com/kb/295334
>
> Jim.
>
> -----Original Message-----
> From: accessd-bounces@databaseadvisors.com
> [mailto:accessd-bounces@databaseadvisors.com] On Behalf Of Mark A
> Matte
> Sent: Friday, February 01, 2008 10:36 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] App using Runtime?
>
>
> Anythoughts on Compacting without loading access?
>
> Thanks,
>
> Mark
>
>
>> Date: Fri, 1 Feb 2008 10:25:41 -0500
>> From: jimdettman@verizon.net
>> To: accessd@databaseadvisors.com
>> Subject: Re: [AccessD] App using Runtime?
>>
>> Mark,
>>
>> < it?>>
>>
>> Creation and the maintaining of the .LDB file is a function of JET,
>> not Access. Access does not need to be installed (full or runtime) to
>> use a
> JET
>> backend with an app (say written in VB or C++).
>>
>> Jim.
>>
>> -----Original Message-----
>> From: accessd-bounces@databaseadvisors.com
>> [mailto:accessd-bounces@databaseadvisors.com] On Behalf Of Mark A
>> Matte
>> Sent: Friday, February 01, 2008 10:07 AM
>> To: Access Developers discussion and problem solving
>> Subject: [AccessD] App using Runtime?
>>
>>
>> Hello All,
>>
>> An old app showed up...it is not access...but uses an mdb(A97) as a
>> back end. When the app is running...there is and LDB present? Access
>> is NOT on the machine.
>>
>> Does this mean that the runtime is being used?...if so, how do I find it?
>>
>> The problem is the company is migrating to XP...and the users used to
>> use
>> A97 to go in and compact this mdb...and converting the mdb to XP
>> seems to
> be
>> a problem. If the runtime were on the machine...I could drop an A97
>> mde on that machine that compacts the mdb...
>>
>> Thanks,
>>
>> Mark A. Matte