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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB sycrohnize code for multiple databases

Status
Not open for further replies.

applejackson

Programmer
Jun 11, 2002
4
US
I am looking for visual basic code to use that will synchronize multiple replicas of an access database. As it stands now I have to open the design master and synchronize each replica one at a time. Does anyone know of code that will allow me to do all replicas in one shot?
 
Something like this ought to work, of course you'll need to add error handling and check throught this, but this should do the trick

there is a system table called MSysReplicas that houses all the info on all your replicas

this will open that table and loop through your replicas synchronyzing along the way. The if statement should skip the design master, which is where you should be running this from...

Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset(msysreplicas)

Do Until rst.EOF
If Len(rst!transporterId & "") = 0 Then
CurrentDb.Synchronize rst!UNCPathName
End If
rst.MoveNext
Loop Kyle [pc2]
 
Kyle,

Thanks for the help, but I am still having some isssues. I am still learning VB so please bear with me. :)

First question:

The system table called MSysReplicas, should I be able to see this in the design window of the Design Master? If so I don't.

Second Question:

The UNC path. This application replicas are on four different serves in three countries, how do I handle this or am I missing something.

Hopefully these questions make sense? Again I am still somewhat of a greenhorn in VB. I have managed to hack my way this far :S Thanks again

applejackson :)
 
applejackson,

To see the table you'll need to go to Tools --> Options in your menu and on the View tab, select "System Objects" then hit OK, the MSys tables will then appear. The UNCpath is the field in the table that houses the path to the dB, it stores the server name and so on so it should still work, as long as you have an active connection to that server.

on this line here:

CurrentDb.Synchronize rst!UNCPathName

take a look at the Help on "Synchronize" in Access's help files for some examples and ideas on options you have (what type fo synchronozation, for example)

Hope this helps,
If you have any more questions, please ask! Kyle [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top