We are lucky and get to run an 11 year old version of Access (97). I have set up a master with 5 replicas. These are located on various network drives in our organization. Is there any macro/code I can use to have the master auto sync each of the replicas when opened? the Microsoft website sucks and didn't help me at all. I would love any advice or help.
Auto Syncing Replicas
Collapse
X
-
Originally posted by NeoPaI'm afraid if that's as clear as you can be then I'm unable to help.
Sorry about the confusion. I am looking for "Replicatio n Code" that I can put into a macro that will run the sync procedure out of sight of the user. The only thing I found was from the Microsoft website http://support.microsoft.com/kb/183710/en-us
This is kind of what I need, but an actual working same so I can change the BD names and paths.Comment
-
!!!WARNING - this code exists only in the crevices of my mind! (LOL)! It has not been tested, since I do not have the means to, and I make no guarantee whatsoever as to how well it will work, or if it will even work at all. DO NOT USE THIS CODE ON THE LIVE MASTER AND REPLICAS! All that being said:- Create a Table named tblReplicas, and within this Table create a single Field name [Replica_Path].
- Create 5 New Records in tblReplicas consisting of the 'Absolute' Network Path of the 5 Replicas, including the Database Name, such as:
K:\Server4\Data bases\Replicas\ Replica_1.mdb - Depending on how you want the Replication Process to perform, namely: MASTER ==> Replica, Replica ==> MASTER, MASTER <==> Replica, select 1 of the 3 With..End With code segments below.
Code:'To Send changes from the MASTER to the Replica With rstReplicas --Do While Not .EOF ----MyDB.Synchronize ![Replica_Path], dbRepExportChanges ----.MoveNext '.MoveNext --Loop End With --- 'To have the MASTER receive changes from the Replica With rstReplicas --Do While Not .EOF ----MyDB.Synchronize ![Replica_Path], dbRepImportChanges ----.MoveNext --Loop End With --- 'Changes from both the MASTER and Replica are exchanged '(Default - Bi-directional exchange) With rstReplicas --Do While Not .EOF ----MyDB.Synchronize ![Replica_Path], dbRepImpExpChanges ----.MoveNext --Loop End With
- Execute the following code from 'within the MASTER'.
Code:Dim MyDB As DAO.Database Dim rstReplicas As DAO.Recordset --- Set MyDB = CurrentDb() --- Set rstReplicas = MyDB.OpenRecordset("tblReplicas", dbOpenForwardOnly) --- With rstReplicas --Do While Not .EOF ----'Use only [1] of 3 Synchronize Options listed below ----MyDB.Synchronize ![Replica_Path], dbRepExportChanges --- ------------------------ OR ----MyDB.Synchronize ![Replica_Path], dbRepImportChanges --- ------------------------ OR ----MyDB.Synchronize ![Replica_Path], dbRepImpExpChanges --- ------------------------ OR ----.MoveNext --Loop End With --- rstReplicas.Close Set rstReplicas = Nothing - If you need any explanation on the code, either muself or one of the other Members will assist you.
- Say a Prayer, and let me know how you make out.
Comment
-
Sorry for the delay but I had to go to Ny for work and this wasn't part of that work. I tried it today but I can get it to run. I am not very good with VB so I keep getting complier error when debuging. This is what I used.Originally posted by ADeziiKindly let me know the outcome, I'm interested myself.
For some reason it does not like "Set MyDB" Not sure why.Code:Dim MyDB As DAO.Database Dim rstReplicas As DAO.Recordset Set MyDB = CurrentDb() Set rstReplicas = MyDB.OpenRecordset("tblReplicas", dbOpenForwardOnly) With rstReplicas Do While Not .EOF MyDB.Synchronize ![Replica_Path], dbRepImpExpChanges .MoveNext Loop End With rstReplicas.Close Set rstReplicas = NothingComment
-
Make sure you have a Reference set to the Microsoft DAO X.X Object LibraryOriginally posted by jzalarSorry for the delay but I had to go to Ny for work and this wasn't part of that work. I tried it today but I can get it to run. I am not very good with VB so I keep getting complier error when debuging. This is what I used.
For some reason it does not like "Set MyDB" Not sure why.Code:Dim MyDB As DAO.Database Dim rstReplicas As DAO.Recordset Set MyDB = CurrentDb() Set rstReplicas = MyDB.OpenRecordset("tblReplicas", dbOpenForwardOnly) With rstReplicas Do While Not .EOF MyDB.Synchronize ![Replica_Path], dbRepImpExpChanges .MoveNext Loop End With rstReplicas.Close Set rstReplicas = NothingComment
-
Do you have a reference (Tools / References...) set to Microsoft DAO 3.6 Object Library (or similar version)?Originally posted by jzalarFor some reason it does not like "Set MyDB" Not sure why.
PS. Possibly needed to refresh the page before replying - but I was doing some testing. I did find that this reference is not set automatically (Would have thought it would be).Comment
Comment