Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Saturday, July 7, 2012 9:42 AM
I have tried to follow many websites but it worked only with Access 2003.
Some sites suggest to change "Engine Type=5"; so that it supports later version of Access.
Here is the code below that I got from other website. It doesn't work with Access 2007 or 2010 although I have changed "Engine type From 4 to 5".
Dim jro As JRO.JetEngine
jro = New JRO.JetEngine
jro.CompactDatabase("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=computer.accdb;Jet OLEDB:Database Password=test", _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=computer1.accdb;Jet OLEDB:Engine Type=5;Jet OLEDB:Database Password=test")
All replies (2)
Saturday, July 7, 2012 11:15 AM ✅Answered | 1 vote
Please see the "community content" note at the bottom of this link: http://msdn.microsoft.com/en-us/library/bb237197(v=office.12).aspx
--
Mike
Saturday, July 7, 2012 2:30 PM ✅Answered
Thank Family Tree Mike!!
It works now.
It's just few line only.
Dim obj As New Microsoft.Office.Interop.Access.Dao.DBEngine()
obj.CompactDatabase("1.accdb", "2.accdb")