C
Clay
Hello All,
I haven't posted to this group in a while and I am still very much a newbie
when it comes to programming.
I know this is not the newsgroup for replication..but I need help with a
basic loop for syncing a few databases in a replication setup.
Below is what I am code I am currently using, which works....
##########
Public Function sync1()
'Modified CBK 05-09-01
Dim hub As String
hub = "C:\database\hub.mdb"
Call synchronizedbs(hub, "C:\projects\1111.mdb", 2)
Call synchronizedbs(hub, "C:\projects\2222.mdb", 2)
Call synchronizedbs(hub, "C:\projects\3333.mdb", 2)
##This will cause a network/disk error....
##Call synchronizedbs(hub, "C:\projects\*.mdb", 2)
End Function
Sub synchronizedbs(strdbname As String, strsynctargetdb As String, _
intsync As Integer)
Dim dbs As Database
Set dbs = DBEngine(0).OpenDatabase(strdbname)
Select Case intsync
Case 1 'synchronize replicas (bidirectional exchange).
dbs.Synchronize strsynctargetdb, dbRepImpExpChanges
Case 2 'synchronize replicas (export changes).
dbs.Synchronize strsynctargetdb, dbRepExportChanges
Case 3 'synchronize replicas (Import changes).
dbs.Synchronize strsynctargetdb, dbRepImportChanges
Case 4 'synchronize replicas (Internet).
dbs.Synchronize strsynctargetdb, dbRepSyncInternet
End Select
dbs.Close
End Sub
#######
The part of the code I want to ask about is how to loop thru a directory and
sync every database in that directory....instead of having to add a line of
code each time a new database is added to the directory...
I would greatly appreciate if anyone could give me some clues into writing
this loop.
Thanks again for your time and knowledge.
Clay
I haven't posted to this group in a while and I am still very much a newbie
when it comes to programming.
I know this is not the newsgroup for replication..but I need help with a
basic loop for syncing a few databases in a replication setup.
Below is what I am code I am currently using, which works....
##########
Public Function sync1()
'Modified CBK 05-09-01
Dim hub As String
hub = "C:\database\hub.mdb"
Call synchronizedbs(hub, "C:\projects\1111.mdb", 2)
Call synchronizedbs(hub, "C:\projects\2222.mdb", 2)
Call synchronizedbs(hub, "C:\projects\3333.mdb", 2)
##This will cause a network/disk error....
##Call synchronizedbs(hub, "C:\projects\*.mdb", 2)
End Function
Sub synchronizedbs(strdbname As String, strsynctargetdb As String, _
intsync As Integer)
Dim dbs As Database
Set dbs = DBEngine(0).OpenDatabase(strdbname)
Select Case intsync
Case 1 'synchronize replicas (bidirectional exchange).
dbs.Synchronize strsynctargetdb, dbRepImpExpChanges
Case 2 'synchronize replicas (export changes).
dbs.Synchronize strsynctargetdb, dbRepExportChanges
Case 3 'synchronize replicas (Import changes).
dbs.Synchronize strsynctargetdb, dbRepImportChanges
Case 4 'synchronize replicas (Internet).
dbs.Synchronize strsynctargetdb, dbRepSyncInternet
End Select
dbs.Close
End Sub
#######
The part of the code I want to ask about is how to loop thru a directory and
sync every database in that directory....instead of having to add a line of
code each time a new database is added to the directory...
I would greatly appreciate if anyone could give me some clues into writing
this loop.
Thanks again for your time and knowledge.
Clay