Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automate replication

Status
Not open for further replies.

idono

Technical User
Jan 16, 2002
71
US
Is it possible to automate the replication of an Access 2000 database. We have two front ends and a backend. I would like to have a user when done with the database (on-close) have it synchronize. Does this sound possible?

 
Here's what I use, though I have it linked to a switchboard button:
Code:
'********************
'*
'*  @AUTHOR    :  Mike Slama (slamkeys@ev1.net)
'*  @PURPOSE   :  Handle replication
'*  @DATE      :  8/20/2002
'*  @NOTES     :  Checks to see whether current database is the
'*                Master or Replica and adjusts the path accordingly.
'*
'********************
Public Sub ReplicateMe()
On Error GoTo ErrHandler
  Dim db As Database
  Dim strDBType As String
  Dim strPath As String
  Dim strMsg As String
  Set db = CurrentDb
  
  If db.DesignMasterID = db.ReplicaID Then
    strDBType = "Design Master"
    strPath = "\\Xp-mobile\ToshibaS607\Access\SlamKeys\Replica of Time and Billing.mdb"
  Else
    strDBType = "Replica"
    strPath = "\\Slammer\C\My Documents\Access\SlamKeys Billing\Time and Billing.mdb"
  End If
  
  Select Case strDBType
    Case "Design Master"
      strMsg = "You are the design master, would you like to synchronize with the replica?"
    Case "Replica"
      strMsg = "You are a replica, would you like to synchronize with the Master?"
    Case Else
      Exit Sub
  End Select
  
  If MsgBox(strMsg, vbQuestion + vbOKCancel, "SlamKeys Billing") = vbOK Then
    DoCmd.Hourglass True
    SysCmd acSysCmdSetStatus, "Synchronizing databases, please wait..."
    db.Synchronize strPath, dbRepImpExpChanges
  Else
    GoTo ExitHere
  End If
  
  DoCmd.Hourglass False
  SysCmd acSysCmdSetStatus, "Operation Complete!"
  MsgBox "Sychronization successful!", vbInformation, strDBType
  
ExitHere:
  DoCmd.Hourglass False
  SysCmd acSysCmdClearStatus
  Exit Sub
ErrHandler:
  MsgBox "Sychronization failed!", vbCritical, "SlamKeys Billing"
  Resume ExitHere
End Sub

VBSlammer
redinvader3walking.gif

Unemployed in Houston, Texas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top