Hello all.



I've made a database and created a set of replicas from it, but the users have requested a button to synchronize the replcia databases with the master one. I've looked into using a macro, but as Access needs to close all objects to activate the synch, it doesn't work. I've found a piece of VB code that seems to do exactly what I need, but for the life of my I can't get it to work! I know very little about programming, so it's quite possible I'm just not modifying it in the right way. Either way, if anyone could point me in the right direction I would be eternally greatful!

The code I found:


Private Sub Command0_Click()


Call SynchronizeDBsJRO("local database path", "master database path", 3, 2)


End Sub



Sub SynchronizeDBsJRO(strReplicaName As String, strSynchWith As String, _

intSynchType As Integer, intSynchMode As Integer)


Dim rep As JRO.Replica

Set rep = New JRO.Replica
rep.ActiveConnection = strReplicaName
rep.Synchronize strSynchWith, intSynchType, intSynchMode
Set rep = Nothing

MsgBox "Databases have now been Syncronised", vbInformation, "Information"


DoCmd.Quit



End Sub

The error I'm getting after modifying this script is 'User defined type not defined'. Access hilghits the three line segment:Sub SynchronizeDBsJRO

The databases are called Master and Replica_of_Master.


I have input the local and master database paths, And also:

Sub SynchronizeDBsJRO(strReplica_Of_Master As String, strSynchWith As String, _
intSynchType As Integer, intSynchMode As Integer)

Dim rep As JRO.Replica

Set rep = New JRO.Replica
rep.ActiveConnection = strReplica_of_Master
rep.Synchronize strSynchWith, intSynchType, intSynchMode
Set rep = Nothing


Thanks in advance for the help I'm on access 2003.