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:
Public Function QueryOtherDB() Dim dbc As DAO.Workspace Dim rsInfo As DAO.Recordset Dim conn As DAO.Connection 'This line throws the error Set conn = OpenConnection("myConn", , False, "ODBC;DATABASE=Q:\path\myDB.mdb") Set rsInfo = conn.OpenRecordset("SELECT * FROM tblErrorLog") While Not rsInfo.EOF MsgBox rsInfo.Fields(0) & " " & rsInfo.Fields(1) & " " & rsInfo.Fields(2) Wend rsInfo.Close conn.Close dbc.Close End Function




Reply With Quote