I posted a thread earlier on in the week regarding compacting a database in using the JRO object

The problem was the DB was Access97 but would not open it after the compact.

I found out why in the tips section of the forum.

The code I used was this

Code:
    Dim objBU As JRO.JetEngine
    Set objBU = New JRO.JetEngine

    objBU.CompactDatabase "Data Source=" & sSource, _
                    "Data Source=" & sBackUp

This did what it was supposed to do but I was unable to open the database up in Access. In the forum I found this.

Code:
    Dim objBU As JRO.JetEngine
    Set objBU = New JRO.JetEngine

                objBU.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;" _
                                    & "Data Source=" & sSource, _
                                      "Provider=Microsoft.Jet.OLEDB.4.0;" _
                                    & "Data Source=" & sBackUp _
                                    & ";Jet OLEDB:Engine Type=4"
The main factor in this is the Jet OLEDB:Engine Type

This specifies the version to compact it into.
  • 4 = 97
  • 5 = 2000

Thought this may be of use to someone.