I would like to transfer some records of a table from one Mysql DB to another(2 different IP addresses). I have both DB's connected via ODBC and the two tables as table link in my Access DB.
currentdb.execute "insert into Table_DB1 (col1,col2,col3) select col1, col2, col3 from Table_DB1 where col3 between #2020/01/01 0:00:00# and #2020/01/02 23:59:59#"
There is an index on col3 of Table_DB1 and only 60k records of this selection. But it is either very slow or Access stops responding.Is there a faster way of transferring data between 2 remote DB's in Access VB ?
I created ADODB connection and recordset for both source and destination tables as below. The speed of transfer is acceptable.
Dim Con_Dest As New ADODB.Connection
Dim Con_Sour As New ADODB.Connection
Dim Rs_Sour As New ADODB.Recordset
Dim Rs_Dest As New ADODB.Recordset
Dim Str_SqlSour As String
Dim Str_SqlDest As String
Dim Str_Sql As String
Con_Sour.Open "dsn=xxx;uid=xxx;pwd=xxx"
Con_Dest.Open "dsn=yyy;uid=yyy;pwd=yyy"
Str_SqlSour = "select * from Table_Source"
Rs_Sour.Open Str_SqlSour, Con_Sour
Rs_Dest.Open "Table_Dest", Con_Dest, adOpenDynamic, adLockOptimistic
Rs_Sour.MoveFirst
Do Until Rs_Sour.EOF
With Rs_Dest
.AddNew
.Fields("AAA").Value = Rs_Sour.Fields("Col1")
.Fields("AAB").Value = Rs_Sour.Fields("Col2")
.....
.Update
End With
Rs_Sour.MoveNext
Loop