Mirror one table from 1 db to another
- From: "Andy DF" <nospam@xxxxxxxxxx>
- Date: Mon, 19 Jun 2006 17:52:49 +0200
I have 2 jet DBs located on 2 different machines.
The structure of the 2 DBs is identical.
A set of users makes changes to DB A while another set users makes changes
to DB B.
I need to be able to merge data regularly from a certain table on DB B to
the corresponding table in DB A.
I seem to recall that there's a way with UpdateBatch that won't require
having to loop thru the records and comparing them.
Here's the code I came up with. I t doesn't work.
Any help appreciated.
TIA.
Andy
'*********************************************************************************
Public Sub MirrorTable()
Dim oConn1 As Connection
Dim oConn2 As Connection
Dim rs As Recordset
Dim sDB1 As String
Dim sDB2 As String
' Main routine
' Assemble db path's
sDB1 = App.Path & "\db1.mdb"
sDB2 = App.Path & "\db2.mdb"
' Open connection 1
Set oConn1 = New Connection
oConn1.ConnectionString = "Provider=MSDataShape.1;Persist Security
Info=False;Data Source=" & sDB1 & ";Data Provider=MICROSOFT.JET.OLEDB.4.0"
oConn1.Open
' Open table
Set rs = New Recordset
rs.CursorLocation = adUseServer
rs.Open "MyTable", oConn1, adOpenDynamic, adLockBatchOptimistic,
adCmdTable
' Open connection 2
Set oConn2 = New Connection
oConn2.ConnectionString = "Provider=MSDataShape.1;Persist Security
Info=False;Data Source=" & sDB2 & ";Data Provider=MICROSOFT.JET.OLEDB.4.0"
oConn2.Open
rs.ActiveConnection = oConn2
rs.UpdateBatch ' -> No update takes place!!!
End Sub
.
- Follow-Ups:
- Re: Mirror one table from 1 db to another
- From: Stephen Howe
- Re: Mirror one table from 1 db to another
- Prev by Date: Re: Here's a rather broad question...
- Next by Date: Re: default values for Oracle stored procedure
- Previous by thread: Re: default values for Oracle stored procedure
- Next by thread: Re: Mirror one table from 1 db to another
- Index(es):
Relevant Pages
|
|