Click to See Complete Forum and Search --> : Access97: Opening the Synchronize Database dialog though VBA
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
Mongo
May 16th, 2000, 06:50 AM
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!
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
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.