Hi,

I am using MS Access 2003. I am trying to query a table in another database, but can't seem to get it... This is my first time trying to run a query against any database other than the one I'm working in. I've read through some of the Object Viewer documentation, but I can't seem to get a good overview of how it should all come together.

When I try to run the following code I receive an error:
Operation is not supported for this type of object
VB Code:
  1. Public Function QueryOtherDB()
  2.     Dim dbc As DAO.Workspace
  3.     Dim rsInfo As DAO.Recordset
  4.     Dim conn As DAO.Connection
  5.    
  6.     'This line throws the error
  7.     Set conn = OpenConnection("myConn", , False, "ODBC;DATABASE=Q:\path\myDB.mdb")
  8.     Set rsInfo = conn.OpenRecordset("SELECT * FROM tblErrorLog")
  9.    
  10.     While Not rsInfo.EOF
  11.         MsgBox rsInfo.Fields(0) & " " & rsInfo.Fields(1) & " " & rsInfo.Fields(2)
  12.     Wend
  13.    
  14.     rsInfo.Close
  15.     conn.Close
  16.     dbc.Close
  17. End Function