Results 1 to 2 of 2

Thread: Access97: Opening the Synchronize Database dialog though VBA

  1. #1
    Guest

    Question

    Hello all,

    I have a little VBA script and I'd like to open the Synchronize Database dialog from this script. Does anyone know how I can accomplish this???

    The Synchronize Database dialog is accessed though the Tools > Replication > Synchronize Now menu item.

    Thank you in advance.

    Regards, Anthony

  2. #2
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Leavenworth KS USA
    Posts
    482
    I've not had the need to try or do what you're asking,
    but thought this might be of some help. I found it using
    "synchronize" & "CreateReplica" as my keywords.

    Hope it helps or at least gives you a few useful ideas!


    Code:
    Public Sub DirectSync()
    
       Dim repMaster As New JRO.Replica
       Dim RepNorthwind As New JRO.Replica
       Dim conn As New ADODB.Connection
    
       ' Open the database.
       conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
          "Data source=C:\Program Files\Microsoft Office\" & _
          "Office\Samples\Northwind.mdb;"
    
       ' If a replica of the database exists, it is deleted.
       repMaster.ActiveConnection = conn
       ' "C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb"
       If (Dir("C:\Program Files\Microsoft Office\" & _
          "Office\Samples\Replica of Northwind.mdb") <> "") Then Kill _
          ("C:\Program Files\Microsoft Office\" & _
          "Office\Samples\Replica of Northwind.mdb")
    
       ' Create a new replica of the database.
       repMaster.CreateReplica "C:\Program Files\Microsoft Office\" & _
          "Office\Samples\Replica of Northwind.mdb", _
          "Replica1 for Northwind.mdb", _
          jrRepTypeFull, jrRepVisibilityGlobal
    
       ' New values are put into tab1.
    On Error Resume Next
       conn.Execute "drop table tab1"
    On Error GoTo 0
       conn.Execute "create table tab1 ( col1 int)"
       conn.Execute "insert into tab1 values (1)"
       conn.Execute "insert into tab1 values (2)"
    
       ' Synchronize the values.
       repMaster.Synchronize "C:\Program Files\Microsoft Office\" & _
          "Office\Samples\Replica of Northwind.mdb", jrSyncTypeImpExp, _
          jrSyncModeDirect
    
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width