3. Create a temporary folder and copy the DB
[VB.NET CODE STARTS]
Rename(strAccessDatabasePath, TempFolder.FullName & "\" & "tmp1.mdb")
[VB.NET CODE ENDS]
4. Create an object of JRO JetEngine and call the compact method , to compact the tempdb and replace at the original location. After compacting delete the temp folder along with its contents.
[VB.NET CODE STARTS]
Dim JRO As New JRO.JetEngine
JRO.CompactDatabase("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source= " & TempFolder.FullName & "\" & "tmp1.mdb", _
"Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & strAccessDatabasePath & ";Jet OLEDB:Engine Type=5")
TempFolder.Delete(True)
[VB.NET CODE ENDS]