Access9001
Registered User.
- Local time
- Today, 07:40
- Joined
- Feb 18, 2010
- Messages
- 268
Can anyone write a quick sub that basically opens a recordset from another database, iterates through them all, then closes correctly? My code isn't working properly:
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = OpenDatabase("\\path\otherdb.mdb")
Set rst = db.OpenRecordset("SELECT * FROM Table_Name")
Do While Not rs.EOF
MsgBox rs("Col_name")
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
I'd also like to use ADODB
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = OpenDatabase("\\path\otherdb.mdb")
Set rst = db.OpenRecordset("SELECT * FROM Table_Name")
Do While Not rs.EOF
MsgBox rs("Col_name")
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
I'd also like to use ADODB