Afternoon all
Could someone please give me a hand making a DAO connection to another database, with a view to copying the data in a table on that database and pasting/appending it to a table in my current database.
Please note that I cannot have linked tables for security reasons (don't ask this wasn’t my decision!)
I've never done a DAO connection across database’s before so my attempt is as follows, but predictably its doesn’t work.
Could anyone give me some help with where its going wrong? Or if your feeling especially kind write me a template that I can adapt…
I am getting an error “Item not found in this collection” on the line where I Set WODB
But no doubt that wont be the only error I get!
Thank you
Could someone please give me a hand making a DAO connection to another database, with a view to copying the data in a table on that database and pasting/appending it to a table in my current database.
Please note that I cannot have linked tables for security reasons (don't ask this wasn’t my decision!)
I've never done a DAO connection across database’s before so my attempt is as follows, but predictably its doesn’t work.
Could anyone give me some help with where its going wrong? Or if your feeling especially kind write me a template that I can adapt…

Code:
Sub GetData()
Dim MAINDB As DAO.Database
Dim MAINRS As DAO.Recordset
Set MAINDB = CurrentDb
Set MAINRS = MAINDB.OpenRecordset("tblCoreData")
Dim WODB As DAO.Database
Dim WORS As DAO.Recordset
Set WODB = CurrentDb("\\Path\db1.mdb")
Set WORS = WODB.OpenRecordset("tbldata")
If WORS.BOF And WORS.EOF Then
MsgBox "No Records"
Else
MsgBox "Records Exist"
End If
Set WORS = Nothing
Set MAINRS = Nothing
End Sub
I am getting an error “Item not found in this collection” on the line where I Set WODB
But no doubt that wont be the only error I get!
Thank you
