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