Coding Question

C

Clay

To All:

I have an existing ms access 2000 application that I sync multiple databases
with.

In the sync1 function below I am syncing the 0102.mdb file with my main
hub.mdb database.

My question is can I use a text file that lists all the databases I want to
sync with?

I am not an efficient coder so please excuse my ignorance...but could I
change the line...

Call synchronizedbs(hub, "\\pe2600\jobs\0102\Dbase\0102.mdb", 2).....to

Call synchronizedbs(hub, "c:\text-file-list.txt", 2)...and
text-file-list.txt just has a list of paths to different databases...like

\\pe2600\jobs\0102\Dbase\0102.mdb
\\pe2600\jobs\0104\Dbase\0104.mdb
\\pe2600\jobs\0110\Dbase\0110.mdb
\\pe2600\jobs\0111\Dbase\0111.mdb

and the synchronizedbs function would loop thru all the paths listed in the
text file....

Both functions are listed below for reference.....

Anyway thanks for any input and please excuse my lack of coding skills...

Thanks

Clay



Public Function sync1()
Dim hub As String

hub = "p:\apps\database\jobs_databases\hub.mdb"


Call synchronizedbs(hub, "\\pe2600\jobs\0102\Dbase\0102.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
 
M

Michael J. Strickland

Clay said:
To All:

I have an existing ms access 2000 application that I sync multiple
databases
with.

In the sync1 function below I am syncing the 0102.mdb file with my main
hub.mdb database.

My question is can I use a text file that lists all the databases I want
to
sync with?

I am not an efficient coder so please excuse my ignorance...but could I
change the line...

Call synchronizedbs(hub, "\\pe2600\jobs\0102\Dbase\0102.mdb", 2).....to

Call synchronizedbs(hub, "c:\text-file-list.txt", 2)...and
text-file-list.txt just has a list of paths to different databases...like

\\pe2600\jobs\0102\Dbase\0102.mdb
\\pe2600\jobs\0104\Dbase\0104.mdb
\\pe2600\jobs\0110\Dbase\0110.mdb
\\pe2600\jobs\0111\Dbase\0111.mdb

and the synchronizedbs function would loop thru all the paths listed in
the
text file....

Both functions are listed below for reference.....

Anyway thanks for any input and please excuse my lack of coding skills...

Thanks

Clay



Public Function sync1()
Dim hub As String

hub = "p:\apps\database\jobs_databases\hub.mdb"


Call synchronizedbs(hub, "\\pe2600\jobs\0102\Dbase\0102.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

Yes.

You need to open the text file, read each line (filename) into
strsynctargetdb, and then call your sync routine.

To read the text file, check out the TextStream and FileSystem objects in
the help section.

You will also need to add the "MS Scripting Runtime" reference (Tools->
References).

Or you can use the old file I/O commands (Open, Input#, etc..) to read the
text file.


--
 
C

Clay

Michael J. Strickland said:
Yes.

You need to open the text file, read each line (filename) into
strsynctargetdb, and then call your sync routine.

To read the text file, check out the TextStream and FileSystem objects in
the help section.

You will also need to add the "MS Scripting Runtime" reference (Tools->
References).

Or you can use the old file I/O commands (Open, Input#, etc..) to read the
text file.


--


Thanks Micheal for pointing me in the right direction....now hopefully I can
get the coding correct...

Clay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top