How do I copy a table from another database into my current database?
I tried this but it deletes my data in rstWin even though I made a clone, I guess the clone function doesnt make a copy of the recordset.
Code:
Dim dbWin As DAO.Database
Dim rstWin As DAO.Recordset
Dim rstClone As DAO.Recordset
Set dbWin = OpenDatabase(strInputFileName)
Set rstWin = dbWin.OpenRecordset("S_T")
Set rstClone = rstWin.Clone
rstWin.Close
Set rstWin = Nothing
'current database
Dim cdb As DAO.Database
Dim crst As DAO.Recordset
Set cdb = CurrentDb()
Set crst = cdb.OpenRecordset("Pipes")
rstClone.MoveFirst
If crst.RecordCount > 0 Then
Do While Not rstClone.EOF
crst.MoveFirst
Do While Not crst.EOF
If crst![SegID] = rstClone!S_LocDetails Then
crst.Edit
If IsNull(rstClone!S_Street) = False Then
crst!Street = rstClone!S_Street
End If
rstClone.Edit
rstClone.Delete
crst.Update
End If
crst.MoveNext
Loop
rstClone.MoveNext
Loop
End If
rstClone.MoveFirst
any help is appreciated thanks