record set for pass through query

  • Thread starter Thread starter iccsi
  • Start date Start date
I

iccsi

I have a pass through query which execute a stored procedure from SQL
Server backend.

I have following code to get record set of the query, but MS Access
fails.
It looks like MS Access can not use DAO to get recordset of pass
through query.
If yes, any work around?
Your information is great appreciated,

Dim qdfCurr As DAO.QueryDef
Dim rs As DAO.Recordset

Set qdfCurr = CurrentDb().QueryDefs("MyQuery")
qdfCurr.SQL = "EXECUTE MyStoredProcedure"
Set rs = qdfCurr.OpenRecordset()

MS Access fails when the code set recordset from DAO.QueryDef
 
Is MyQuery set up with a valid Connection property for a pass-through query?
Does it work if you simply double-click on the query?

There's nothing syntactically incorrect with what you've posted: assuming
the query is set up properly, it should work.


Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/djsteele
Co-author: "Access Solutions", published by Wiley
(no e-mails, please!)


"iccsi" wrote in message

I have a pass through query which execute a stored procedure from SQL
Server backend.

I have following code to get record set of the query, but MS Access
fails.
It looks like MS Access can not use DAO to get recordset of pass
through query.
If yes, any work around?
Your information is great appreciated,

Dim qdfCurr As DAO.QueryDef
Dim rs As DAO.Recordset

Set qdfCurr = CurrentDb().QueryDefs("MyQuery")
qdfCurr.SQL = "EXECUTE MyStoredProcedure"
Set rs = qdfCurr.OpenRecordset()

MS Access fails when the code set recordset from DAO.QueryDef
 
Back
Top