Converting DAO Replication to JRO

See Also

In Addition to the ADO and ADOX object libraries Microsoft Access provides Jet and Replication Objects (JRO). This set of objects provides an object model and methods that are specifically designed for use with ADO and the Jet Database Engine.

Note   You must first create a reference to MSJRO.DLL by selecting References on the Tools menu and selecting Microsoft Jet and Replication Objects 2.1 Library to use JRO functionality.

Below are listed some common DAO Replication methods and their JRO equivalents.

DAO ADO(JRO) Note
DBEngine JetEngine  
Database Catalog  

Creating a Replica
'Given an open database Object dbReplicable
Dim dbTemp As Database

Set dbTemp=OpenDatabase(dbReplicable)
dbTemp.MakeReplica strNewReplica, _
"Replica of " & strReplicableDB
dbsTemp.Close
Dim rpMaster As New JRO.Replica
rpMaster.MakeReplicable "northwind.mdb",False 
Set rpMaster = Nothing
rpMaster.ActiveConnection ="northwind.mdb"
rpMaster.CreateReplica "northwind2.mdb", _
 "My Full Replica1", jrRepTypeFull, jrRepVisibilityGlobal
Set rpMaster = Nothing
Compact and Encrypt a Database
Dim dbNWD As Database
Set dbNWD =OpenDatabase("Northwind.mdb")
DBEngine.CompactDatabase "Northwind.mdb", _
"NWD_DAOComp.mdb", , dbEncrypt
Dim je As New JRO.JetEngine
je.CompactDatabase _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Northwind.mdb", _   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=NWD_ADOComp.mdb.mdb;" _
& "Jet OLEDB:Encrypt Database=True"