Sync Button

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

I just want to create a button that runs the "Synchronize Now" function. I've
plugged in the sample I found in the knowlege base in the OnClick property of
the command button:

Replica.Synchronize ("C:\My Documents\databasename")

But it's not working. The location just above is where the master DB would
be. There is only one replica on a laptop computer that syncs when plugged
into the network in the office. The sync function would be ran on the replica
DB.Thank you for your help.
 
I've also tried this code:

Private Sub cmdSync_Click()
MsgBox "This will synchronize your data"
Dim dbs As Database <-----Error here----<
Set dbs = OpenDatabase("C:\Documents and Settings\....")
dbs.Synchronize "H:\Documents and Settings\..."
MsgBox "Synchronization is complete"
End Sub

I get and error message "User-defined type not defined". I've also tried
using "db1" and get error message "Expected user-defined type, not project".
Please, this is the last step in my project. Thank you.
 
I figured it out. Here is the code if anyone is searching the same thing:

Private Sub cmdSync_Click()

Dim dbRemote As DAO.Database

MsgBox "Click OK to continue synchronizing"

Set dbRemote = DBEngine.OpenDatabase("C:\Documents and Settings\...\Replica
of CONTACT.mdb")
dbRemote.Synchronize "C:\Program Files\Microsoft
Office\Office\Samples\CONTACT.mdb"

dbRemote.Close
Set dbRemote = Nothing

On Error GoTo ErrorHandler

MsgBox "Synchronization Complete"
DoCmd.Close
Exit Sub

ErrorHandler:
MsgBox "Synchronization Failed!"

End Sub

I would have been happy if I could just run the "SynchronizeNow" from a
macro and put it on the Switchboard, but Microsoft never fixed it.
Access versions 2000 - XP (not sure if 2007 supports synchronizing)
 
Back
Top