Dr. Watson error while opening a recordset
Posted on 2002-04-07
Well.. here's the problem. I use VBA for some automation purposes. My back-end is SQL Server. I build a query using the user-inputs(like table-name, DSN name etc).
My code runs like this...
Set wrkODBC = CreateWorkspace("", "user", "", dbUseODBC)
Set conDB = wrkODBC.OpenConnection("cnConnect", dbDriverNoPrompt, , "ODBC;DATABASE="+strDatabase+";UID=user;PWD=;DSN=" + strODBCDriver)
Set rs = conDB.OpenRecordset(strQuery, dbOpenSnapshot)
All's well until the last statement. I debugged, and when I pressed F8 on the line Set rs = ..., Dr. Watson error got thrown and Excel closed.
Pls. note that the query that I build in strQuery references the tables - syscolumns and sysobjects - read-only tables for this user.
Any help is appreciated.