Results 1 to 11 of 11
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Cross-update Two Mdb's (2003)

    Why not keep the tables in one database, and link to them in the other database?

  2. #2
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cross-update Two Mdb's (2003)

    Does that work even if each mdb is on a different pc?

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cross-update Two Mdb's (2003)

    If you have two mdb files containing the same tables and you modify data in one file, is there a way to transfer the modifications onto the other file without importing or updating whole tables?
    Problem is there is one(! <img src=/S/smile.gif border=0 alt=smile width=15 height=15>) line of vba code that is different in one file with respect to the other file and by synchronising them through replication the two lines of code are made the same while I need them to stay different.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Cross-update Two Mdb's (2003)

    Are both PCs on the same network?

  5. #5
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cross-update Two Mdb's (2003)

    I'm afraid they're standalone pc's. Otherwise I'd have split the databases.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Cross-update Two Mdb's (2003)

    Perhaps you can make the code in the two databases identical, so that you can use replication. You could create a special registry entry on one of the two PC's, or a dummy text file, and use this to let the code determine on which PC the database is, and execute the appropriate line of code.

  7. #7
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cross-update Two Mdb's (2003)

    The code would be the same if I could avoid naming the file to be synchronised in
    <font color=448800> rep1.Synchronize "c:My Documentspada.mdb", _ </font color=448800>
    which is part of the following routine
    <font color=red>
    Sub Ricarica()

    Dim fso, file1, Scelta
    Dim Start As Double
    Dim FileAgg As String
    Dim fp As String
    Dim FD As FileDialog
    Dim rep1 As JRO.Replica
    Dim cnn1 As New ADODB.Connection
    Dim rst1 As ADODB.Recordset

    Set FD = Application.FileDialog(msoFileDialogFolderPicker)
    If FD.Show = False Then
    GoTo Exit_SalvaMdb
    End If
    fp = FD.SelectedItems.Item(1)
    Shell fp & "Pada.exe", 0


    Set cnn1 = CurrentProject.Connection
    Set rep1 = New JRO.Replica
    rep1.ActiveConnection = cnn1
    rep1.Synchronize "c:My Documentspada.mdb", _
    jrSyncTypeImpExp, jrSyncModeDirect
    FileAgg = CurrentPath & "pada.mdb"

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set file1 = fso.GetFile(FileAgg)

    If fso.FileExists(FileAgg) Then
    fso.deletefile (FileAgg)
    End If

    Set file1 = Nothing
    Set fso = Nothing
    MsgBox "I'm done"
    Exit_SalvaMdb:
    End Sub </font color=red>

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Cross-update Two Mdb's (2003)

    Not sure what you want, but you could obtain the name from the registry, or from a text file.

  9. #9
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cross-update Two Mdb's (2003)

    So what would the syntax of
    <font color=448800>rep1.Synchronize "c:My Documentspada.mdb", _ </font color=448800>
    turn into if I used a text file?

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Cross-update Two Mdb's (2003)

    Add the following declarations to the beginning of the procedure:

    Dim ts As Object
    Dim strDatabase As String

    Move the line

    Set fso = CreateObject("Scripting.FileSystemObject")

    up to just above the line with rep1.Synchronize. The code becomes:

    ' Open the text file
    Set ts = fso.OpenTextFile("C:Settings.txt")
    ' Read a single line from the text file into the variable strDatabase
    strDatabase = ts.ReadLine
    ' Close the text file
    ts.Close
    ' And release the object memory
    Set ts = Nothing
    ' Synchronize
    rep1.Synchronize strDatabase

  11. #11
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cross-update Two Mdb's (2003)

    Awesome!! <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23> <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •