Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Coding Question

Discussion in 'Information Technology' started by Clay, Jul 28, 2006.

  1. Clay

    Clay
    Expand Collapse
    Guest

    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
     
  2. Loading...

    Similar Threads Forum Date
    SciTech Kids "using coding skills to hack" Friends on Games Breaking News Feb 10, 2013
    Opinion Mayan tablet decoding rules out 2012 apocalypse Breaking News Dec 1, 2011
    Question About GGS Questions and Answers Aug 28, 2016
    Marriage And Discrimination Related Questions Blogs Mar 21, 2016
    Sikhi Questioning Faith Sikh Sikhi Sikhism Mar 3, 2016

  3. Michael J. Strickland

    Michael J. Strickland
    Expand Collapse
    Guest

    "Clay" <clayway@excite.com> wrote in message
    news:83ff9$44858577$42e2c932$6695@airband.net...
    > 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.


    --
    ---------------------------------------------------------------
    Michael J. Strickland
    Quality Services qualityser@att.net
    703-560-7380
    ---------------------------------------------------------------
     
  4. Clay

    Clay
    Expand Collapse
    Guest

    "Michael J. Strickland" <qualityser@worldnet.att.net> wrote in message
    news:xPghg.688$mF2.522@bgtnsc04-news.ops.worldnet.att.net...
    > "Clay" <clayway@excite.com> wrote in message
    > news:83ff9$44858577$42e2c932$6695@airband.net...
    >> 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.
    >
    >
    > --
    > ---------------------------------------------------------------
    > Michael J. Strickland
    > Quality Services qualityser@att.net
    > 703-560-7380
    > ---------------------------------------------------------------
    >



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

    Clay
     

Share This Page