Replicate a database
Posted by: fredometro on
Jan 1st, 2004 |
Filed under: MS-Access
This function replicates a database with another replica, or the master database.
The databases are secured.
Public Function RunReplication(TheMaster, TheRemote, UserName, Password)
Dim db As Database
Dim myDBE As DBEngine
Dim dbMyNewMdb As Database
Dim ws As Workspace
On Error GoTo Err_RunReplication
Set myDBE = New PrivDBEngine
myDBE.SystemDB = DBEngine.SystemDB
myDBE.DefaultUser = UserName
myDBE.DefaultPassword = Password
Set ws = myDBE.CreateWorkspace("ws", UserName, Password)
Set dbMyNewMdb = ws.OpenDatabase(TheMaster)
RunReplication = True
On Error Resume Next
dbMyNewMdb.Synchronize TheRemote
If Err <> 0 Then
MsgBox Error$
RunReplication = False
End If
On Error GoTo Err_RunReplication
dbMyNewMdb.Close
Set dbMyNewMdb = Nothing
Exit Function
Err_RunReplication:
MsgBox Error$, vbCritical
RunReplication = False
End Function
No related posts.

Tags:
Add A Comment
You must be logged in to post a comment.