The
ProgrammingMSAccess.COM Site
A
vba Procedure that LIST
ALL THE VISIBLE REPLICAS TO THE ONE SPECIFIED BY fILESPEC (USE THE FULL PATH TO
SPECIFY THE NAME OF THE REPLICA)
'This procedure requires a reference to the
'Jet and Replication Objects 2.1 Library
Sub enumerateVisibleReplicaMembers(Filespec As String)
Dim rst1 As ADODB.Recordset
Dim cnn1 As ADODB.Connection
Dim rep1 As New JRO.Replica
'Open connection to source replica after making sure that it
'synchronizes with all other replicas in the replica set
Set cnn1 = New ADODB.Connection
cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Filespec
'Open recordset based on UNCPathname column in
'the MSysReplicas table; return set matches entries
'in Directly replicate with drop-down box on
'the Synchronize Now dialog
Set rst1 = New ADODB.Recordset
rst1.Open "SELECT DISTINCT MSysReplicas.UNCPathname " & _
"as ReplicaName FROM MSysReplicas " & _
"WHERE MSysReplicas.Removed Is Null", _
cnn1, adOpenKeyset, adLockOptimistic
'Name source replica
Debug.Print "Results for source replica named:" & _
vbCrLf & Filespec & vbCrLf
'Loop through all visible members in source's replica set
Debug.Print "The number of visible replicas is " & _
rst1.RecordCount & _
", and their path and file names are:"
Do Until rst1.EOF
Debug.Print rst1.Fields("ReplicaName")
rst1.MoveNext
Loop
End Sub
Want to understand Microsoft Access 2000/2002/2003 so that you can program it to
do more tasks like this? Get Programming Microsoft Office Access
2003
by Rick Dobson from Microsoft Press. Learn more about the book by clicking
here.
Copyright 2003 CAB, Inc. All rights reserved. Republication or redistribution
of CAB, Inc. content, including by framing or similar means, is expressly
prohibited without the prior written consent of CAB, Inc. CAB, Inc. shall not be
liable for any errors in the content, or for any actions taken in reliance
thereon.