Set reference to Microsoft DAO 3.6 Object Library
You need to know your connection string options which are somewhat finicky but the code would look something like:
Code:
Dim dbConnect As Database, wsEngine As Workspace, rsSource as Recordset
Set wsEngine = CreateWorkspace("ODBCWorkspace","[User Name]","[Password]",dbUseODBC)
Set dbConnect = wsEngine.OpenDatabase("[Name]",[Options],[ReadOnly] -True Or False-,"[Connect]" -The DB connection String-)
Set rsSource = dbConnect.OpenRecordset("Select * From TableName Where Conditions")
Do While Not rsSource.EOF
msgbox rsSource("FieldName1").value
***Whatever else you want to do with recordset***
rsSource.MoveNext
Loop
rsSource.Close
dbConnect.Close
wsEngine.Close
Set dbConnect = Nothing
Set wsEngine = Nothing
Hope this helps point in the right direction. Be sure to read up on createworkspace command in the office help file.