VBA/Excel/Access/Word/Access/Database Replica

Материал из VB Эксперт
Перейти к: навигация, поиск

Creating a Design Master

   <source lang="vb">

Sub Create_DesignMaster(dbName As String, strPath As String)

   Dim repDesignMaster As New JRO.Replica 
   Dim myFileSystemObject As Scripting.FileSystemObject 
   Dim strDb As String 
   Set myFileSystemObject = New FileSystemObject 
   strDb = strPath & "DM_" & dbName 
   If Not myFileSystemObject.FileExists(strDb) Then 
       myFileSystemObject.CopyFile strPath & dbName, strDb 
   Else 
       Debug.Print "The " & strDb & " database file already exists." 
       Exit Sub 
   End If 
   repDesignMaster.MakeReplicable strDb, True 
   Set repDesignMaster = Nothing 
   Set myFileSystemObject = Nothing 

End Sub

</source>
   
  


Creating a Full Replica

   <source lang="vb">

Sub Make_FullReplica(DesignMasterName As String, _

            NewRepName As String) 
   Dim repDesignMaster As New JRO.Replica 
   With repDesignMaster 
       .ActiveConnection = DesignMasterName 
       .CreateReplica CurrentProject.Path & "\" & NewRepName, _ 
           "Replica of " & DesignMasterName 
   End With 

End Sub

</source>