Question : Convert Access2 to Access2000 Programatically

How can I convert Access2 Databases to Access2000 using code? I need to convert a few hundred databases and am working on some functions to do the coding upgrades, I'm having trouble working out how to do the initial database conversion without having to manually convert via tools, Database Utilities etc. The closest code I've seen is..

Const Jet10 = 1
Const Jet11 = 2
Const Jet20 = 3
Const Jet3x = 4
Const Jet4x = 5

DoConvertMDB "G:\database\BuShell.MDB", "G:\database\BuShell2000.MDB", Jet4x

Sub DoConvertMDB(SourceDB, DestDB, Format)
    Dim Engine
    Set Engine = CreateObject("JRO.JetEngine")
    Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & SourceDB, _
      "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=" & Format & ";Data Source=" & DestDB
End Sub

This leaves the database in an unusable state, when opened Access2000 asks you to use convert instead. Thought about using "RunCommand acCmdConvertDatabase" but have no idea how to go about it.

Anyone seen code that could help?

Answer : Convert Access2 to Access2000 Programatically

Can't you use the command line parameter /convert.

Access helps says : Converts a previous-version Access database to an Access 2000 database with a new name, and then closes Microsoft Access. You must specify the source database before you use the /convert option.

I would suggest creating a batch file, e.g. convert.bat with the following script :

"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" %1 /CONVERT %2

Then you can call it like

Convert ACCESS2.MDB ACCESS2000.MDB

regards, Ivan


Random Solutions  
 
programming4us programming4us