record set for pass through query

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
 
D

Douglas J. Steele

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top