Hi there,
I tried to copy data from one data base to another. Sometimes it works pretty well, but sometimes not all data are copy over. Could Anyone tell me what really happend?
This is what I have:
Dim cn1 As ADODB.Connection
Dim strCn1 As String
Dim strPathtoDB1 As String
Dim cn2 As ADODB.Connection
Dim strCn2 As String
Dim strPathtoDB2 As String
Set cn1 = New ADODB.Connection
Set cn2 = New ADODB.Connection
'DATABASE ON SERVER
strPathtoDB1 = "\\Server\Database1.mdb"
cn1.CursorLocation = adUseClient
strCn1 = "PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathtoDB1 & _
";Jet OLEDB
atabase Password=mypassword"
cn1.Open strCn1
'LOCAL HARD DISK
strPathtoDB2 = App.Path & "\Database2.mdb"
cn2.CursorLocation = adUseClient
strCn2 = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathtoDB2 & _
";Jet OLEDB
atabase Password=mypassword"
cn2.Open strCn2
'perform the data transfer from local to server
cn2.Execute "INSERT INTO Table1 IN " & _
"'" & strPathtoDB1 & "'" & " SELECT * FROM Table2"
Thanks
I tried to copy data from one data base to another. Sometimes it works pretty well, but sometimes not all data are copy over. Could Anyone tell me what really happend?
This is what I have:
Dim cn1 As ADODB.Connection
Dim strCn1 As String
Dim strPathtoDB1 As String
Dim cn2 As ADODB.Connection
Dim strCn2 As String
Dim strPathtoDB2 As String
Set cn1 = New ADODB.Connection
Set cn2 = New ADODB.Connection
'DATABASE ON SERVER
strPathtoDB1 = "\\Server\Database1.mdb"
cn1.CursorLocation = adUseClient
strCn1 = "PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathtoDB1 & _
";Jet OLEDB
cn1.Open strCn1
'LOCAL HARD DISK
strPathtoDB2 = App.Path & "\Database2.mdb"
cn2.CursorLocation = adUseClient
strCn2 = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathtoDB2 & _
";Jet OLEDB
cn2.Open strCn2
'perform the data transfer from local to server
cn2.Execute "INSERT INTO Table1 IN " & _
"'" & strPathtoDB1 & "'" & " SELECT * FROM Table2"
Thanks