Sincronize two Access Tables in different Dbase

neideb

Registered User.
Local time
Today, 18:04
Joined
Oct 9, 2001
Messages
42
I wish I could read records in two tables (two DBase but same fields) and update missing records.
I already have a module but I am having intermitent errors.
I would appreciate your help. Thanks a lot
 
you should first determine what Field holds unique key (primary key).
you then just insert records where the key is missing.
then do an update for missing columns info.

sample code:

Code:
Private Sub t()
Dim db As DAO.Database
Set db = CurrentDb
'Insert missing records
db.Execute "insert into [Table1] select * from [Table1] As T in '" & _
    Environ("userprofile") & "\pathName\Externaldb.accdb' where T.PK not in (select PK from Table1]);"

'Insert missing field values    
db.Execute "update [Table1] As A, " & _
    "(Select * From [Table1] In " & _
    "'" & Environ("userprofile") & "\pathName\Externaldb.accdb') As B " & _
    "Set A.Field1 = B.Field1, A.Field2=B.Field2 where B.PK = A.PK;"


End Sub
 
Last edited:
Hi. Are we talking bi-directional synchronization or is one db always the master?
 
but I am having intermitent errors
Do something about the errors.
Did you notice the content of the reports?
 

Users who are viewing this thread

Back
Top Bottom